Skip to content

Commit

Permalink
fix: display manualChunks warning only when a function is not used (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jafin authored Jul 21, 2023
1 parent 049404c commit 51c271f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/vite/src/node/plugins/splitVendorChunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,14 @@ export function splitVendorChunkPlugin(): Plugin {
output.manualChunks = (id: string, api: ManualChunkMeta) => {
return userManualChunks(id, api) ?? viteManualChunks(id, api)
}
} else {
// else, leave the object form of manualChunks untouched, as
// we can't safely replicate rollup handling.
// eslint-disable-next-line no-console
console.warn(
"(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead.",
)
}
// else, leave the object form of manualChunks untouched, as
// we can't safely replicate rollup handling.
// eslint-disable-next-line no-console
console.warn(
"(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.manualChunks`. Consider using the function form instead.",
)
} else {
output.manualChunks = viteManualChunks
}
Expand Down

0 comments on commit 51c271f

Please sign in to comment.