vite打包时报错 <stdin>:348:0: warning: "@charset" must be the first rule in the file 的解决办法

在根目录下创建postcss.config.js

module.exports = {
  plugins: [
    {
      postcssPlugin: 'internal:charset-removal',
      AtRule: {
        charset: (atRule) => {
          if (atRule.name === 'charset') {
            atRule.remove()
          }
        }
      }
    }
  ]
}

 

posted @ 2022-03-10 22:08  赵永强  阅读(1210)  评论(0)    收藏  举报