Skip to content
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

Vite server crashes when starting dev server after optimizing new dependencies [ERR_OUTDATED_OPTIMIZED_DEP] #7369

Closed
7 tasks done
Ragura opened this issue Mar 18, 2022 · 4 comments · Fixed by #7378
Closed
7 tasks done
Labels
p4-important Violate documented behavior or significantly improves performance (priority)

Comments

@Ragura
Copy link

Ragura commented Mar 18, 2022

Describe the bug

As a followup to a discussion with @patak-dev on Discord, I'd like to report a bug with the Vite 2.9.0-beta.2 release concerning the optimization of newly discovered dependencies.

While Vite 2.9.0-beta.2 does resolve another issue by only optimizing dependencies once at server start, there is an additional bug where the server crashes right after starting (with dev command) when there is a newly discovered dependency, such as through a newly added import statement in one of the source files. Upon subsequent server starts, it will no longer yield the error and cold boot correctly.

In this example, the following error appears when a new element plus dependency is discovered. Note that this isn't specific to element plus, as it also happens with packages such as lodash-es and its modules.

11:13:25 [vite] new dependencies found: element-plus/es, updating...
11:13:26 [vite] ✨ dependencies updated, reloading page...
11:13:26 [vite] new dependencies found: element-plus/es/components/loading/style/index, updating...
11:13:27 [vite] ✨ dependencies updated, reloading page...
/Users/myuser/development/tutori-frontend/node_modules/.pnpm/vite@2.9.0-beta.2_sass@1.49.9/node_modules/vite/dist/node/chunks/dep-6ae84d6b.js:51603
    const err = new Error(`There is a new version of the pre-bundle for "${id}", ` +
                ^

Error: There is a new version of the pre-bundle for "/Users/myuser/development/tutori-frontend/node_modules/.vite/deps/element-plus_es_components_loading_style_index.js?v=9e9dea5b", a page reload is going to ask for it.
    at throwOutdatedRequest (/Users/myuser/development/tutori-frontend/node_modules/.pnpm/vite@2.9.0-beta.2_sass@1.49.9/node_modules/vite/dist/node/chunks/dep-6ae84d6b.js:51603:17)
    at Context.load (/Users/myuser/development/tutori-frontend/node_modules/.pnpm/vite@2.9.0-beta.2_sass@1.49.9/node_modules/vite/dist/node/chunks/dep-6ae84d6b.js:51557:29)
    at Object.load (/Users/myuser/development/tutori-frontend/node_modules/.pnpm/vite@2.9.0-beta.2_sass@1.49.9/node_modules/vite/dist/node/chunks/dep-6ae84d6b.js:35159:50)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async doTransform (/Users/myuser/development/tutori-frontend/node_modules/.pnpm/vite@2.9.0-beta.2_sass@1.49.9/node_modules/vite/dist/node/chunks/dep-6ae84d6b.js:51433:24) {
  code: 'ERR_OUTDATED_OPTIMIZED_DEP'

It is easily reproduced by cloning the Element Plus Vite starter template, changing the Vite version to 2.9.0-beta.2, running pnpm upgrade, starting the dev server and navigating to the app in the browser.

Reproduction

In issue description

System Info

System:
    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 185.30 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.0.1 - ~/.nvm/versions/node/v17.0.1/bin/node
    npm: 8.3.1 - ~/.nvm/versions/node/v17.0.1/bin/npm
  Browsers:
    Chrome: 99.0.4844.74
    Safari: 15.4
  npmPackages:
    @vitejs/plugin-vue: ^2.2.4 => 2.2.4 
    vite: 2.9.0-beta.2 => 2.9.0-beta.2

Used Package Manager

pnpm

Logs

No response

Validations

@Ragura Ragura changed the title Vite server crashes when starting dev server after optimizing new dependencies Vite server crashes when starting dev server after optimizing new dependencies [ERR_OUTDATED_OPTIMIZED_DEP] Mar 18, 2022
@bluwy
Copy link
Member

bluwy commented Mar 19, 2022

Is this already fixed by #7345?

@patak-dev
Copy link
Member

Just tested with #7378 and it is working as expected. We can close this one after merging it.

@patak-dev patak-dev added bug p4-important Violate documented behavior or significantly improves performance (priority) and removed pending triage labels Mar 19, 2022
@patak-dev patak-dev linked a pull request Mar 19, 2022 that will close this issue
4 tasks
@patak-dev
Copy link
Member

@Ragura let us know how vite@2.9.0-beta.4 works for you. Thanks for the report!

@Ragura
Copy link
Author

Ragura commented Mar 21, 2022

@Ragura let us know how vite@2.9.0-beta.4 works for you. Thanks for the report!

This does appear to be fixed! Big thanks to the team for the work!

@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p4-important Violate documented behavior or significantly improves performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants