From d94b3f14829248b215c7dd0c2e257826ec6ae10e Mon Sep 17 00:00:00 2001 From: yujiacheng Date: Thu, 6 Apr 2023 08:10:47 +0000 Subject: [PATCH] =?UTF-8?q?cdn=E6=89=93=E5=8C=85=E6=94=AF=E6=8C=81pnp?= =?UTF-8?q?m=EF=BC=8C=E6=B6=88=E9=99=A4=E6=97=A0external=E7=9A=84=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20=E5=8E=9F=E7=AE=97=E6=B3=95=E4=BC=9A=E5=B0=86?= =?UTF-8?q?=E4=BD=BF=E7=94=A8pnpm=E5=AE=89=E8=A3=85=E7=9A=84=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=AD=E6=89=80=E6=9C=89=E6=A8=A1=E5=9D=97=E5=90=8D?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=8C=B9=E9=85=8D=E4=B8=BA.pnpm=EF=BC=8C?= =?UTF-8?q?=E4=B8=94=E5=9C=A8=E5=85=B3=E9=97=ADcdn=E6=89=93=E5=8C=85?= =?UTF-8?q?=E6=97=B6=E4=BC=9A=E6=8A=A5=E9=94=99=EF=BC=9AUnknown=20output?= =?UTF-8?q?=20options:=20external.=20Allowed=20options:=20amd,=20assetFile?= =?UTF-8?q?Names,=20banner,=20chunkFileNames,=20compact,=20dir,=20dynamicI?= =?UTF-8?q?mportFunction,=20dynamicImportInCjs,=20entryFileNames,=20esModu?= =?UTF-8?q?le,=20experimentalDeepDynamicChunkOptimization,=20experimentalM?= =?UTF-8?q?inChunkSize,=20exports,=20extend,=20externalImportAssertions,?= =?UTF-8?q?=20externalLiveBindings,=20file,=20footer,=20format,=20freeze,?= =?UTF-8?q?=20generatedCode,=20globals,=20hoistTransitiveImports,=20indent?= =?UTF-8?q?,=20inlineDynamicImports,=20interop,=20intro,=20manualChunks,?= =?UTF-8?q?=20minifyInternalExports,=20name,=20namespaceToStringTag,=20noC?= =?UTF-8?q?onflict,=20outro,=20paths,=20plugins,=20preferConst,=20preserve?= =?UTF-8?q?Modules,=20preserveModulesRoot,=20sanitizeFileName,=20sourcemap?= =?UTF-8?q?,=20sourcemapBaseUrl,=20sourcemapExcludeSources,=20sourcemapFil?= =?UTF-8?q?e,=20sourcemapIgnoreList,=20sourcemapPathTransform,=20strict,?= =?UTF-8?q?=20systemNullSetters,=20validate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yujiacheng --- vite.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 037c187..822b503 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -49,11 +49,11 @@ const viteConfig = defineConfig((mode: ConfigEnv) => { assetFileNames: 'assets/[ext]/[name]-[hash].[ext]', manualChunks(id) { if (id.includes('node_modules')) { - return id.toString().split('node_modules/')[1].split('/')[0].toString(); + return id.toString().match(/\/node_modules\/(?!.pnpm)(?[^\/]*)\//)?.groups.moduleName ?? 'vender'; } }, }, - external: JSON.parse(env.VITE_OPEN_CDN) ? buildConfig.external : [], + ...(JSON.parse(env.VITE_OPEN_CDN) ? {external: buildConfig.external} : {}), }, }, css: { preprocessorOptions: { css: { charset: false } } }, -- Gitee