From 49da98619692779df58673b9cc6004dd824a6f15 Mon Sep 17 00:00:00 2001 From: sanyuan <39261479+sanyuan0704@users.noreply.github.com> Date: Tue, 28 Dec 2021 05:30:54 +0800 Subject: [PATCH] fix: seperate source and dep for dymamic import after build (#6251) --- packages/vite/src/node/build.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index e64cc618135bb0..e5b51ec92be040 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -647,12 +647,12 @@ function getPkgName(root: string) { function createMoveToVendorChunkFn(config: ResolvedConfig): GetManualChunk { const cache = new Map() return (id, { getModuleInfo }) => { - if ( - id.includes('node_modules') && - !isCSSRequest(id) && - staticImportedByEntry(id, getModuleInfo, cache) - ) { - return 'vendor' + if (id.includes('node_modules') && !isCSSRequest(id)) { + if (staticImportedByEntry(id, getModuleInfo, cache)) { + return 'vendor' + } else { + return 'async-vendor' + } } } }