From ac03526ea51cb1baae67ab7dd2ee1e085f6a57a4 Mon Sep 17 00:00:00 2001 From: java2sap <39330069+sapuser2017@users.noreply.github.com> Date: Fri, 31 Dec 2021 13:33:50 +0800 Subject: [PATCH] Update vite.config.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加新的组件后,vite打包报错@charset,需要增加配置 --- vite.config.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vite.config.js b/vite.config.js index 95648c4..c44b715 100644 --- a/vite.config.js +++ b/vite.config.js @@ -32,5 +32,22 @@ export default defineConfig(({ mode, command }) => { } }, }, + //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file + css: { + postcss: { + plugins: [ + { + postcssPlugin: 'internal:charset-removal', + AtRule: { + charset: (atRule) => { + if (atRule.name === 'charset') { + atRule.remove(); + } + } + } + } + ], + }, + }, } })