question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extremely slow config resolution (55s+) on macOS

See original GitHub issue

Describe the bug

I started using Vitest (and Vite) for the first time this morning, and I’m running into the issue that the config resolution seems to be extremely slow. After Vite has booted up, recompilation is fast.

The debug output shows that the config lookup is fast, but then it takes 55 seconds to resolve the config.

I don’t encounter the issue when running Vite in a Docker container.

Reproduction

  1. npm create vite@latest 2. npm install 3. npm run dev – --debug

System Info

System:
    OS: macOS 12.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 23.73 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.volta/tools/image/node/16.16.0/bin/node
    Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
    npm: 8.15.0 - ~/.volta/tools/image/npm/8.15.0/bin/npm
  Browsers:
    Chrome: 104.0.5112.79
    Firefox: 101.0
    Firefox Developer Edition: 98.0
    Safari: 15.6
  npmPackages:
    vite: ^3.0.7 => 3.0.8

Used Package Manager

npm

Logs

Click to expand!
λ ~/Code/Timon/vite-test/ DEBUG=* npm run dev

> vite-test@0.0.0 dev
> vite

  vite:config no config file found. +0ms
  vite:config using resolved config: {
  vite:config   root: '/Users/timon.vanspronsen/Code/Timon/vite-test',
  vite:config   base: '/',
  vite:config   mode: 'development',
  vite:config   configFile: undefined,
  vite:config   logLevel: undefined,
  vite:config   clearScreen: undefined,
  vite:config   optimizeDeps: {
  vite:config     disabled: 'build',
  vite:config     force: undefined,
  vite:config     esbuildOptions: { preserveSymlinks: undefined }
  vite:config   },
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     middlewareMode: false,
  vite:config     fs: { strict: true, allow: [Array], deny: [Array] }
  vite:config   },
  vite:config   configFileDependencies: [],
  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   resolve: { alias: [ [Object], [Object] ] },
  vite:config   publicDir: '/Users/timon.vanspronsen/Code/Timon/vite-test/public',
  vite:config   cacheDir: '/Users/timon.vanspronsen/Code/Timon/vite-test/node_modules/.vite',
  vite:config   command: 'serve',
  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   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:dynamic-import-vars',
  vite:config     'vite:import-glob',
  vite:config     'vite:client-inject',
  vite:config     'vite:import-analysis'
  vite:config   ],
  vite:config   build: {
  vite:config     target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: 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   },
  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   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(0) {},
  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: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   },
  vite:config   appType: 'spa',
  vite:config   experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false }
  vite:config } +55s
  connect:dispatcher use / viteTimeMiddleware +0ms
  connect:dispatcher use / corsMiddleware +2ms
  connect:dispatcher use /__open-in-editor launchEditorMiddleware +0ms
  connect:dispatcher use / viteServePublicMiddleware +0ms
  connect:dispatcher use / viteTransformMiddleware +0ms
  connect:dispatcher use / viteServeRawFsMiddleware +0ms
  connect:dispatcher use / viteServeStaticMiddleware +0ms
  connect:dispatcher use / viteSpaFallbackMiddleware +0ms
  connect:dispatcher use / viteIndexHtmlMiddleware +1ms
  connect:dispatcher use / vite404Middleware +0ms
  connect:dispatcher use / viteErrorMiddleware +0ms
  vite:deps scanning for dependencies... +0ms

  VITE v3.0.8  ready in 55314 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose
  vite:deps Crawling dependencies using entries:
  vite:deps   /Users/timon.vanspronsen/Code/Timon/vite-test/index.html +0ms
  vite:resolve 0.44ms /main.js -> /Users/timon.vanspronsen/Code/Timon/vite-test/main.js +0ms
  vite:resolve 0.54ms ./counter.js -> /Users/timon.vanspronsen/Code/Timon/vite-test/counter.js +3ms
  vite:deps Scan completed in 85.74ms: {} +71ms
  vite:deps no dependencies found by scanner +86ms

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TimonVScommented, Aug 17, 2022

Sorry, I forgot to mention before, but /Users/timon.vanspronsen/package.json did indeed have a workspaces field. /Users/timon.vanspronsen/Code/Timon/vite-test/package.json does exist.

1reaction
sapphi-redcommented, Aug 16, 2022

Would you run Vite by node --inspect-brk node_modules/vite/bin/vite.js and record profile with the debugger and save/upload the profile json?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change your Mac display's resolution - Apple Support
Set the resolution for a connected display · On your Mac, choose Apple menu > System Settings, then click Displays in the sidebar....
Read more >
Why does MacOS slow down terribly when switching to ...
Hi MacRumors, I have the following setup: MacBook Pro 15“ (Mid 2014) ... switches to this resolution (maybe a little less slow); This...
Read more >
Why is my Mac running slow & how to fix it - MacPaw
In this article, we'll explain why MacBook is running slow and give you ten miraculous fixes to bring it back to speed. Let's...
Read more >
macOS Big Sur Slow or Laggy? 8 Tips to Help Speed Up the ...
If a Mac feels slow or sluggish, one way to possibly find the culprit is to check Activity Monitor for processes that are...
Read more >
How To Fix Slow MacBook With 4K Monitor - YouTube
Having issues viewing 4K content on YouTube or have general slowing down after hooking up your macbook or mac to a 4K monitor?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found