-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
eager dependency pre-bundling is no longer working #28195
Comments
Start a new pull request in StackBlitz Codeflow. |
Hello 👋 this is probably fixed in the nightly channel. can you try adding this piece of code in a module ? nuxt.hook('imports:sources', (sources) => {
const routerImports = sources.find(s => s.from === '#app/composables/router' && s.imports.includes('onBeforeRouteLeave'))
if (routerImports) {
routerImports.from = 'vue-router'
}
}) or try with nuxt-nightly |
@huang-julien Thanks for the quick reply! Unfortunately, it does not work :( Behaviour is the same as with 3.12.3 - https://stackblitz.com/edit/github-um8mfw-4wq7pl |
ooops I commented on the wrong issue 🤦 |
I think we did something with optimizeDeps in 3.12 |
In 3.5 there was a bug with warmup that warming up every single module, we later fixed that so now entries are lazy. And causing those dependencies are not discovered eagerly. I had the impression for a very long time that Vite will pre-optimize entries in I am not sure if we could fix the warmup issue (which defeat the purpose of on-demand), but maybe we could have a better convention allow users to specify the deps to optimize? /cc @danielroe should we provide the |
I made https://github.com/antfu/vite-plugin-optimize-exclude, which might or might not help. If you are interested, please give a try in your full app and see how things would improve for you. |
@antfu Sorry for the slow reply Currently, the best way to resolve the problem for me is to manually add each package to I tried the plugin like that, but there were errors:
|
Environment
Reproduction
Link to project with faulty behaviour (version 3.12.3)
https://stackblitz.com/edit/github-um8mfw-zyx1rr
Link to project with expected (old) behaviour (version 3.5.3)
https://stackblitz.com/edit/github-um8mfw-pufiup
Describe the bug
On the first dev server startup in version 3.5.3, dependencies are optimized eagerly.
While in 3.12.3 dependencies are optimized lazily which may cause waterfall of page reloads significantly affecting developer experience.
This is a problem because:
Each reload is accompanied by this message:
To confirm the issue you need to:
node_modules/.cache
directorynpm run dev
and do NOT visit the page in browsernode_modules/.cache/vite/client/deps
will contain optimized depsnode_modules/.cache/vite/client/deps
will not contain optimized depsAdditional context
No response
Logs
First load log from my project with this issue (look at timestamps)
The text was updated successfully, but these errors were encountered: