Closed wubiandaxian closed 2 years ago
环境: vite: 2.6.11 vite-plugin-style-import: 1.4.0 ant-design-vue: 3.0.0-alpha.12
vite按需加载配置:
styleImport({ libs: [ { libraryName: 'ant-design-vue', esModule: true, resolveComponent: (name) => `ant-design-vue/es/${name}`, resolveStyle: (name) => `ant-design-vue/es/${name}/style/index`, }, ], }),
vite中css预处理的配置
css: { preprocessorOptions: { less: { charset: false, }, scss: { charset: false, }, css: { charset: false, }, }, },
问题: 如果打包的时候,加入了按需引入,就会报如下warning
:4004:0: warning: "@charset" must be the first rule in the file 4004 │ @charset "UTF-8"; ╵ ~~~~~~~~ :3972:0: note: This rule cannot come before a "@charset" rule 3972 │ .ant-spin.ant-spin-show-text .ant-spin-text { ╵ ^
不添加按需引入的配置打包是没有问题的。目前不知道问题出在哪,就来这提issues了
如果按需加载的配置中不写 resolveStyle,也不会报warning
vite的issues里找到了解决办法,但是我依旧不知道这是属于谁的bug
vite: build includes @charset problem.#5833
esbuild的问题: https://github.com/evanw/esbuild/issues/1862
环境: vite: 2.6.11 vite-plugin-style-import: 1.4.0 ant-design-vue: 3.0.0-alpha.12
vite按需加载配置:
vite中css预处理的配置
问题: 如果打包的时候,加入了按需引入,就会报如下warning
不添加按需引入的配置打包是没有问题的。目前不知道问题出在哪,就来这提issues了