-
-
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
modulepreload
polyfill ends up in vendor chunk
#16429
Comments
Start a new pull request in StackBlitz Codeflow. |
Still not fixed |
If you'd like to separate out the preload script from the jspdf chunk, you can configure something like this instead: export default defineConfig({
plugins: [react()],
build: {
rollupOptions: {
output: {
manualChunks: {
jspdf: ['jspdf'],
preload: ['\0vite/preload-helper.js'] // <-- put in its own chunk
}
}
}
}
}) Rollup's chunking behaviour doesn't guarantee that only files in About Closing this one for now as its how Rollup chunks things. |
thanks for the hint how to manually chunk the preload code! |
Describe the bug
I'm using vite with react and I want to extract a vendor library in a separate chunk. For whatever reason the
modulepreload
polyfill always ends up in the vendor chunk and the chunk itself is always preloaded inindex.html
.I have created a very small reproduction which only has the following vite config:
My code does not even import
jspdf
in any way directly, but as soon as I put it as a manual chunk the following output is created:As you can see there really only is the
modulepreload
code but no vendor code. I have also tried to disable the polyfill altogether withbuild.modulePreload.polyfill
set tofalse
, but this does still not disable the code generation.Reproduction
https://stackblitz.com/edit/vitejs-vite-evfakv?file=src%2FApp.tsx,vite.config.ts,dist%2Fassets%2Fjspdf-PNuX44LO.js&terminal=dev
Steps to reproduce
npm run build
dist/assets/jspdf-*.js
contains the module preload polyfill codeindex.html
always preloadsdist/assets/jspdf-*.js
System Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: