From 17587111742d641bc1f081ce0dd6596d8646d751 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Wed, 8 Dec 2021 14:27:39 +0800 Subject: [PATCH] fix: vite build --- vite.config.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 8c5f78032..45d781972 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -39,6 +39,23 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => { resolve: { alias }, + css: { + // https://github.com/vitejs/vite/issues/5833 + postcss: { + plugins: [ + { + postcssPlugin: "internal:charset-removal", + AtRule: { + charset: atRule => { + if (atRule.name === "charset") { + atRule.remove(); + } + } + } + } + ] + } + }, // 服务端渲染 server: { // 是否开启 https @@ -160,8 +177,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => { sourcemap: false, brotliSize: false, // 消除打包大小超过500kb警告 - chunkSizeWarningLimit: 2000, - minify: false + chunkSizeWarningLimit: 2000 }, define: { __INTLIFY_PROD_DEVTOOLS__: false