warning: "@charset" must be the first rule in the file


環境:vite + vue3 + element-plus

問題:打包時出現warning: "@charset" must be the first rule in the file這樣的警告,發現是完整引入element-plus import 'element-plus/dist/index.css',vite打包出現壓縮css的警告。

解決辦法:element-plus按需引入,打包就沒有這種警告了。

// vite.config.ts import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' export default { plugins: [ // ... AutoImport({ resolvers: [ElementPlusResolver()], }), Components({ resolvers: [ElementPlusResolver()], }), ], }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM