From 50595f0fc1b7ce7abdfde53d5939d1297fdea138 Mon Sep 17 00:00:00 2001 From: "494130947@qq.com" <494130947@qq.com> Date: Fri, 24 Dec 2021 09:19:43 +0800 Subject: [PATCH] fix: seperate source and dep for dymamic import after build --- packages/vite/src/node/build.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index e64cc618135bb0..b12a757d10e3ca 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -649,10 +649,13 @@ function createMoveToVendorChunkFn(config: ResolvedConfig): GetManualChunk { return (id, { getModuleInfo }) => { if ( id.includes('node_modules') && - !isCSSRequest(id) && - staticImportedByEntry(id, getModuleInfo, cache) + !isCSSRequest(id) ) { - return 'vendor' + if (staticImportedByEntry(id, getModuleInfo, cache)) { + return 'vendor' + } else { + return 'async-vendor'; + } } } }