From 5b203e8084b05a9f0951839e6e665a440ea261ac Mon Sep 17 00:00:00 2001 From: Jason Finch Date: Wed, 12 Jul 2023 15:55:08 +1000 Subject: [PATCH] fix: Only show the `build.rollupOptions.manualChunks using the function form` warning when a function is not used. (#13797) --- packages/vite/src/node/plugins/splitVendorChunk.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/plugins/splitVendorChunk.ts b/packages/vite/src/node/plugins/splitVendorChunk.ts index b8c5d2ca855b61..3e2a18d0583e5c 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( + 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 }