当前位置:网站首页>Handling of @charset UTF-8 warning problems during vite packaging and construction;

Handling of @charset UTF-8 warning problems during vite packaging and construction;

2022-06-26 01:10:00 Colesyn L.

vite When packaging builds @charset utf-8 Warning problem handling ;

In today's vite A warning occurred while packaging Although it doesn't affect user interaction, I still think it should be handled ;

An error is as follows
 Insert picture description here
terms of settlement

stay vite.config.ts Add css/ and resolve/plugins/server At the same level

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

Pack again and find that the warning is gone
 Insert picture description here

原网站

版权声明
本文为[Colesyn L.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206252312461797.html