Some chunks are larger than 500 KiB after minification
Published at 2024-05-02 17:18:43Viewed 406 times
Professional article
Please reprint with source link
When your vue/nuxt project is large, running npm run build
may output the error :
WARN 15:32:15
(!) Some chunks are larger than 500 KiB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
This is indeed a vite problem. You could solve this error by setting the chunk size limit higher.
vite.config.js
:
//vite.config.js
export default defineConfig({
...,
build: {
chunkSizeWarningLimit: 1600
}
})
nuxt.config.ts
:
//nuxt.config.ts
export default defineNuxtConfig({
vite: {
build: { chunkSizeWarningLimit: 1600 },
}
})
0 人喜欢
Comments
There is no comment, let's add the first one.