How to correctly use manualChunks in nuxt.config.ts (nuxt 3.15.4)
never seen a console output, nor a chunk named sentry when running npm run build
vite: {
build: {
rollupOptions: {
output: {
manualChunks: (id: string) => {
console.log('manualChunks function called with id:', id)
if (id.includes('@sentry/nuxt')) {
return 'sentry'
}
return undefined
},
},
},
},
},nuxt.config.ts under the vite.build.rollupOptions key. This includes the ability to set a custom manualChunks function for advanced code splitting.build configuration in nuxt.config will now be ignored," and you should use the new top-level vite, webpack, and postcss keys for configuration. But even then, some deep customizations may not be fully supported or may be overridden by Nuxt's internal logic Docs: Migration - Build Tooling.manualChunks Working as Expected: In the provided knowledge sources, there are references to chunking and Rollup options, including a warning about large chunks and a suggestion to use manualChunks Stack Overflow: Nuxt3 build .output folder remains empty, nothing copied from .nuxt. However, there is no explicit confirmation that a custom manualChunks function is called or respected during the Nuxt build process. There is also no mention of console output from such a function, nor examples of successful custom chunk naming.chunk.names instead of name PR #30780), but these do not clarify whether user-defined manualChunks functions are supported or how to debug them.manualChunks function or that you will see console output from it. It's possible that Nuxt's build abstraction prevents this function from being used as it would in a plain Vite/Rollup setup. If you need fine-grained control over chunking, you may encounter limitations.manualChunks function as you would expect. There is no documented workaround or official support for this in the provided sources.manualChunks ?vite.build.rollupOptionsmanualChunksmanualChunksmanualChunksmanualChunksmanualChunksmanualChunksmanualChunksmanualChunksbuildnuxt.configvitewebpackpostcsschunk.namesname