-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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 3] Pre-bundling not discovering all dependencies #9052
Comments
@brillout I can't reproduce in MacOS, weird because linux should work in the same way regarding paths. You also need to use |
Indeed I still get A little bit confusing is that the log I'll try to reproduce the In the meantime I guess we can close this. |
I tried to reproduce it, without luck. Let's hope it was a glitch, somehow. |
With
Looks like the scanner isn't finding anything because there are no |
So setting In other words: config: () => ({
ssr: { external: ['vite-plugin-ssr'] },
optimizeDeps: {
entries: [`**/*.page.${javascriptFileExtensions}`, `**/*.page.client.${javascriptFileExtensions}`],
},
}), I just tried that and the scanner finds all dependencies 👌. I'm wondering whether adding all the user's page files could considerably slow down dev start. |
This is a tradeoff with the scanner, and one of the reasons we wanted to remove it. It would probably depend on the user app. For small apps, it is a good default, for larger apps, the best would be to only scan the most common routes, and accept that there will be a reload when visiting some other routes for the first time. We found that esbuild is quite slow when called with a lot of entries, so a possible optimization could be to aggregate all the entries and import them from a dynamically generated single file (for example for your .jsx routes, I think it will be possible) and feed that as the only entry to the scanner. |
vite-plugin-ssr now has both techniques implemented (heuristic determining what pages files should be scanned + aggregate file). Thanks for the tip! |
Describe the bug
Vite 3's pre-bundling phase doesn't seem to discover all dependencies leading to a full page reload.
Reproduction
https://github.com/brillout/vite3-prebundler-bug
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: