Skip to content

Commit

Permalink
perf: remove manual vendor chunking
Browse files Browse the repository at this point in the history
Removes the manual chunking which put all vendor libraries into one chunk. As a result, this chunk was huge and took quite some time to be loaded, especially with slower network connections.

While there might be a case for using (meaningful) manual chunks, it needs more testing. Also, I noticed that it can mess with dynamic imports.
  • Loading branch information
JammingBen committed May 29, 2024
1 parent 7c3ab56 commit 8069073
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,8 @@ export default defineConfig(({ mode, command }) => {
input,
output: {
dir: 'dist',
chunkFileNames: join('js', 'chunks', '[name]-[hash].mjs'),
entryFileNames: join('js', '[name]-[hash].mjs'),
manualChunks: (id: string) => {
if (id.includes('node_modules')) {
return 'vendor'
}
}
chunkFileNames: join('js', 'chunks', `[name]-[hash].mjs`),
entryFileNames: join('js', '[name]-[hash].mjs')
}
},
target: browserslistToEsbuild()
Expand Down

0 comments on commit 8069073

Please sign in to comment.