From 51c271f2bd97ce408e82952045ed516596176596 Mon Sep 17 00:00:00 2001 From: Jason Finch Date: Fri, 21 Jul 2023 17:31:53 +1000 Subject: [PATCH] fix: display manualChunks warning only when a function is not used (#13797) (#13798) --- packages/vite/src/node/plugins/splitVendorChunk.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/vite/src/node/plugins/splitVendorChunk.ts b/packages/vite/src/node/plugins/splitVendorChunk.ts index b8c5d2ca855b61..034b8c2ee5231e 100644 --- a/packages/vite/src/node/plugins/splitVendorChunk.ts +++ b/packages/vite/src/node/plugins/splitVendorChunk.ts @@ -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 }