Some chunks are larger than 500 KiB after minification
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 },
}
})
暂无评论,来发布第一条评论吧!