Skip to content

vite 4.3-beta dep-pre-bundle plugin with yarn enableGlobalCache regression #12713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
7 tasks done
smeng9 opened this issue Apr 3, 2023 · 2 comments · Fixed by #12719
Closed
7 tasks done

vite 4.3-beta dep-pre-bundle plugin with yarn enableGlobalCache regression #12713

smeng9 opened this issue Apr 3, 2023 · 2 comments · Fixed by #12719
Labels
pending triage regression The issue only appears after a new release

Comments

@smeng9
Copy link
Contributor

smeng9 commented Apr 3, 2023

Describe the bug

I am upgrading from vite4.2 to vite4.3-beta and I expect my project can still successfully launch the dev server.

However with new vite 4.3 it cannot pass the findModuleError during dependency resolution back into the 3rd party library code https://github.com/Paciolan/remote-component/blob/master/src/getDependencies.ts#L44 for error handling.

I would consider this a regression in vite 4.3

Reproduction

https://stackblitz.com/edit/vitejs-vite-j4bqyg?file=src%2FApp.tsx,package.json&terminal=dev

Steps to reproduce

  1. Download the project from the reproduction link
  2. Set the yarn version to 3.5 using $ yarn set version berry
  3. Fill in the .yarnrc.yml file with enableGlobalCache: true, only in this specific mode will trigger the error.
  4. Update the dependency vite from 4.2.1 to 4.3.0-beta.1
  5. Run $ yarn && yarn dev
    The step 5 can successfully launch dev server in 4.2.1 but not 4.3.0-beta.1

System Info

System:
    OS: Linux 5.19 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
    Memory: 3.04 GB / 7.22 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.12.0 - /usr/bin/node
    Yarn: 3.5.0 - /usr/bin/yarn
    npm: 8.19.2 - /usr/bin/npm
  Browsers:
    Firefox: 111.0

Used Package Manager

yarn

Logs

Logs are provided below

Click to expand!
  vite:config bundled config file loaded in 512.52ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'vite:pre-alias',
  vite:config     'alias',
  vite:config     'vite:react-babel',
  vite:config     'vite:react-refresh',
  vite:config     'vite:react-jsx',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:optimized-deps',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-proxy',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm-helper',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite:wasm-fallback',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:asset-import-meta-url',
  vite:config     'vite:dynamic-import-vars',
  vite:config     'vite:import-glob',
  vite:config     'vite:client-inject',
  vite:config     'vite:import-analysis'
  vite:config   ],
  vite:config   optimizeDeps: {
  vite:config     disabled: 'build',
  vite:config     force: undefined,
  vite:config     include: [ 'react/jsx-runtime', 'react/jsx-dev-runtime', 'react' ],
  vite:config     esbuildOptions: { preserveSymlinks: false }
  vite:config   },
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     sourcemapIgnoreList: [Function: isInNodeModules],
  vite:config     middlewareMode: false,
  vite:config     fs: { strict: true, allow: [Array], deny: [Array] }
  vite:config   },
  vite:config   esbuild: {
  vite:config     jsxDev: true,
  vite:config     jsx: 'automatic',
  vite:config     jsxImportSource: undefined,
  vite:config     jsxSideEffects: false
  vite:config   },
  vite:config   resolve: {
  vite:config     mainFields: [ 'module', 'jsnext:main', 'jsnext' ],
  vite:config     browserField: true,
  vite:config     conditions: [],
  vite:config     extensions: [
  vite:config       '.mjs',  '.js',
  vite:config       '.mts',  '.ts',
  vite:config       '.jsx',  '.tsx',
  vite:config       '.json'
  vite:config     ],
  vite:config     dedupe: [ 'react', 'react-dom' ],
  vite:config     preserveSymlinks: false,
  vite:config     alias: [ [Object], [Object] ]
  vite:config   },
  vite:config   configFile: '/home/motion/Developer/vite43/vite.config.ts',
  vite:config   configFileDependencies: [ '/home/motion/Developer/vite43/vite.config.ts' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     optimizeDeps: { force: undefined },
  vite:config     server: {}
  vite:config   },
  vite:config   root: '/home/motion/Developer/vite43',
  vite:config   base: '/',
  vite:config   rawBase: '/',
  vite:config   publicDir: '/home/motion/Developer/vite43/public',
  vite:config   cacheDir: '/home/motion/Developer/vite43/node_modules/.vite',
  vite:config   command: 'serve',
  vite:config   mode: 'development',
  vite:config   ssr: {
  vite:config     format: 'esm',
  vite:config     target: 'node',
  vite:config     optimizeDeps: { disabled: true, esbuildOptions: [Object] }
  vite:config   },
  vite:config   isWorker: false,
  vite:config   mainConfig: null,
  vite:config   isProduction: false,
  vite:config   build: {
  vite:config     target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
  vite:config     cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     copyPublicDir: true,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     ssrEmitAssets: false,
  vite:config     reportCompressedSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null,
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
  vite:config     modulePreload: { polyfill: true },
  vite:config     cssMinify: true
  vite:config   },
  vite:config   preview: {
  vite:config     port: undefined,
  vite:config     strictPort: undefined,
  vite:config     host: undefined,
  vite:config     https: undefined,
  vite:config     open: undefined,
  vite:config     proxy: undefined,
  vite:config     cors: undefined,
  vite:config     headers: undefined
  vite:config   },
  vite:config   envDir: '/home/motion/Developer/vite43',
  vite:config   env: { BASE_URL: '/', MODE: 'development', DEV: true, PROD: false },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen],
  vite:config     hasErrorLogged: [Function: hasErrorLogged]
  vite:config   },
  vite:config   packageCache: Map(1) {
  vite:config     'fnpd_/home/motion/Developer/vite43' => {
  vite:config       dir: '/home/motion/Developer/vite43',
  vite:config       data: [Object],
  vite:config       hasSideEffects: [Function: hasSideEffects],
  vite:config       webResolvedImports: {},
  vite:config       nodeResolvedImports: {},
  vite:config       setResolvedCache: [Function: setResolvedCache],
  vite:config       getResolvedCache: [Function: getResolvedCache]
  vite:config     }
  vite:config   },
  vite:config   createResolver: [Function: createResolver],
  vite:config   worker: {
  vite:config     format: 'iife',
  vite:config     plugins: [
  vite:config       'vite:pre-alias',
  vite:config       'alias',
  vite:config       'vite:modulepreload-polyfill',
  vite:config       'vite:optimized-deps',
  vite:config       'vite:resolve',
  vite:config       'vite:html-inline-proxy',
  vite:config       'vite:css',
  vite:config       'vite:esbuild',
  vite:config       'vite:json',
  vite:config       'vite:wasm-helper',
  vite:config       'vite:worker',
  vite:config       'vite:asset',
  vite:config       'vite:wasm-fallback',
  vite:config       'vite:define',
  vite:config       'vite:css-post',
  vite:config       'vite:worker-import-meta-url',
  vite:config       'vite:asset-import-meta-url',
  vite:config       'vite:dynamic-import-vars',
  vite:config       'vite:import-glob',
  vite:config       'vite:client-inject',
  vite:config       'vite:import-analysis'
  vite:config     ],
  vite:config     rollupOptions: {},
  vite:config     getSortedPlugins: [Function: getSortedPlugins],
  vite:config     getSortedPluginHooks: [Function: getSortedPluginHooks]
  vite:config   },
  vite:config   appType: 'spa',
  vite:config   experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false },
  vite:config   getSortedPlugins: [Function: getSortedPlugins],
  vite:config   getSortedPluginHooks: [Function: getSortedPluginHooks]
  vite:config } +14ms
  vite:resolve 3.39ms react/jsx-runtime -> /home/motion/.yarn/berry/cache/react-npm-18.2.0-1eae08fee2-8.zip/node_modules/react/jsx-runtime.js +0ms
  vite:resolve 1.20ms react/jsx-dev-runtime -> /home/motion/.yarn/berry/cache/react-npm-18.2.0-1eae08fee2-8.zip/node_modules/react/jsx-dev-runtime.js +2ms
  vite:resolve 1.51ms react -> /home/motion/.yarn/berry/cache/react-npm-18.2.0-1eae08fee2-8.zip/node_modules/react/index.js +2ms
  vite:deps scanning for dependencies... +0ms
  vite:esbuild 56.05ms tsconfck init /home/motion/Developer/vite43 +0ms

  VITE v4.3.0-beta.1  ready in 812 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
  vite:deps Crawling dependencies using entries: 
  vite:deps   /home/motion/Developer/vite43/index.html +0ms
  vite:resolve 0.36ms /src/main.tsx -> /home/motion/Developer/vite43/src/main.tsx +0ms
  vite:resolve 0.69ms react -> /home/motion/.yarn/berry/cache/react-npm-18.2.0-1eae08fee2-8.zip/node_modules/react/index.js +6ms
  vite:resolve 1.47ms react-dom/client -> /home/motion/Developer/vite43/.yarn/__virtual__/react-dom-virtual-892cad94b5/3/.yarn/berry/cache/react-dom-npm-18.2.0-dd675bca1c-8.zip/node_modules/react-dom/client.js +3ms
  vite:resolve 0.46ms ./App -> /home/motion/Developer/vite43/src/App.tsx +1ms
  vite:resolve 0.69ms react-dom -> /home/motion/Developer/vite43/.yarn/__virtual__/react-dom-virtual-892cad94b5/3/.yarn/berry/cache/react-dom-npm-18.2.0-dd675bca1c-8.zip/node_modules/react-dom/index.js +4ms
  vite:resolve 1.55ms @paciolan/remote-component -> /home/motion/Developer/vite43/.yarn/__virtual__/@paciolan-remote-component-virtual-c4d41441db/3/.yarn/berry/cache/@paciolan-remote-component-npm-2.13.0-d6e5653130-8.zip/node_modules/@paciolan/remote-component/dist/index.js +3ms
  vite:deps Scan completed in 158.70ms: 
  vite:deps   @paciolan/remote-component -> /home/motion/Developer/vite43/.yarn/__virtual__/@paciolan-remote-component-virtual-c4d41441db/3/.yarn/berry/cache/@paciolan-remote-component-npm-2.13.0-d6e5653130-8.zip/node_modules/@paciolan/remote-component/dist/index.js
  vite:deps   react -> /home/motion/.yarn/berry/cache/react-npm-18.2.0-1eae08fee2-8.zip/node_modules/react/index.js
  vite:deps   react-dom -> /home/motion/Developer/vite43/.yarn/__virtual__/react-dom-virtual-892cad94b5/3/.yarn/berry/cache/react-dom-npm-18.2.0-dd675bca1c-8.zip/node_modules/react-dom/index.js
  vite:deps   react-dom/client -> /home/motion/Developer/vite43/.yarn/__virtual__/react-dom-virtual-892cad94b5/3/.yarn/berry/cache/react-dom-npm-18.2.0-dd675bca1c-8.zip/node_modules/react-dom/client.js +114ms
  vite:resolve 0.81ms react-dom -> /home/motion/Developer/vite43/.yarn/__virtual__/react-dom-virtual-892cad94b5/3/.yarn/berry/cache/react-dom-npm-18.2.0-dd675bca1c-8.zip/node_modules/react-dom/index.js +0ms
  vite:resolve 3.44ms @paciolan/remote-module-loader -> /home/motion/.yarn/berry/cache/@paciolan-remote-module-loader-npm-3.0.2-e89b4e109e-8.zip/node_modules/@paciolan/remote-module-loader/dist/index.js +78ms
  vite:resolve 2.49ms react -> /home/motion/.yarn/berry/cache/react-npm-18.2.0-1eae08fee2-8.zip/node_modules/react/index.js +3ms
✘ [ERROR] @paciolan/remote-component tried to access remote-component.config.js, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: remote-component.config.js
Required by: @paciolan/remote-component@virtual:dc23cf8b9c47c478c1e22da996c217a7cb8d51119a184fee2dc5600f5fa7e01223f890c2d2e9da5daa1659bd5fd8e2a4ec7ceaca7da9ee7f9c69ea5329f83920#npm:2.13.0 (via /home/motion/Developer/vite43/.yarn/__virtual__/@paciolan-remote-component-virtual-c4d41441db/3/.yarn/berry/cache/@paciolan-remote-component-npm-2.13.0-d6e5653130-8.zip/node_modules/@paciolan/remote-component/dist)
 [plugin vite:dep-pre-bundle]

    .yarn/__virtual__/@paciolan-remote-component-virtual-c4d41441db/3/.yarn/berry/cache/@paciolan-remote-component-npm-2.13.0-d6e5653130-8.zip/node_modules/@paciolan/remote-component/dist/getDependencies.js:42:59:
      42 │ ...nsureRemoteComponentConfig(require("remote-component.config.js"));
         ╵                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  This error came from the "onResolve" callback registered here:

    .yarn/unplugged/esbuild-npm-0.17.15-92a377fdce/node_modules/esbuild/lib/main.js:1279:20:
      1279 │       let promise = setup({
           ╵                     ^

    at setup (file:///home/motion/Developer/vite43/.yarn/__virtual__/vite-virtual-61ab6f0887/3/.yarn/berry/cache/vite-npm-4.3.0-beta.1-7b77496559-8.zip/node_modules/vite/dist/node/chunks/dep-f365bad6.js:23346:19)
    at handlePlugins (/home/motion/Developer/vite43/.yarn/unplugged/esbuild-npm-0.17.15-92a377fdce/node_modules/esbuild/lib/main.js:1279:21)
    at buildOrContextImpl (/home/motion/Developer/vite43/.yarn/unplugged/esbuild-npm-0.17.15-92a377fdce/node_modules/esbuild/lib/main.js:968:5)
    at Object.buildOrContext (/home/motion/Developer/vite43/.yarn/unplugged/esbuild-npm-0.17.15-92a377fdce/node_modules/esbuild/lib/main.js:776:5)
    at /home/motion/Developer/vite43/.yarn/unplugged/esbuild-npm-0.17.15-92a377fdce/node_modules/esbuild/lib/main.js:2172:68
    at new Promise (<anonymous>)
    at Object.context (/home/motion/Developer/vite43/.yarn/unplugged/esbuild-npm-0.17.15-92a377fdce/node_modules/esbuild/lib/main.js:2172:27)
    at Object.context (/home/motion/Developer/vite43/.yarn/unplugged/esbuild-npm-0.17.15-92a377fdce/node_modules/esbuild/lib/main.js:2012:58)
    at prepareEsbuildOptimizerRun (file:///home/motion/Developer/vite43/.yarn/__virtual__/vite-virtual-61ab6f0887/3/.yarn/berry/cache/vite-npm-4.3.0-beta.1-7b77496559-8.zip/node_modules/vite/dist/node/chunks/dep-f365bad6.js:44954:35)

  vite:resolve 0.84ms http -> __vite-browser-external:http +6ms
  vite:resolve 0.17ms https -> __vite-browser-external:https +0ms
  vite:resolve 1.80ms scheduler -> /home/motion/.yarn/berry/cache/scheduler-npm-0.23.0-a379a6bc3b-8.zip/node_modules/scheduler/index.js +52ms

Validations

@stackblitz
Copy link

stackblitz bot commented Apr 3, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red added the regression The issue only appears after a new release label Apr 3, 2023
@sapphi-red
Copy link
Member

It reproduces with and without enableGlobalCache: true on my machine.
I think this is a regression. Although the error itself is correct. remote-component.config.js resolves to nothing.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending triage regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants