Skip to content

Instantly share code, notes, and snippets.

@Endermanch
Last active January 27, 2024 10:59
Show Gist options
  • Save Endermanch/f721947054f18962fe48467eac46ec34 to your computer and use it in GitHub Desktop.
Save Endermanch/f721947054f18962fe48467eac46ec34 to your computer and use it in GitHub Desktop.
Vite build.rollupOptions.output.manualChunks() example to chunk per each vendor package (node_modules)
...
vite: {
build: {
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.includes('node_modules/')) {
return id
.split('node_modules/')[1]
.split('/')[0]
}
},
},
},
},
},
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment