引用nutui vue3 icon组件,tarojs 3.5.6 执行npm run build:h5 -- --watch,报错postcss-url: Image type is svg and link contains #. Postcss-url cant handle svg fragments.

syqv5f0l  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(68)

相关平台

H5

浏览器版本: Microsoft Edge 版本 114.0.1823.43 (正式版本) (64 位)
使用框架: Vue 3

复现步骤

使用nutui icon的方案一 引入 iconfont,执行npm run build:h5 -- --watch,报错(3:3) postcss-url: Image type is svg and link contains #. Postcss-url cant handle svg fragments. SVG file fully inlined. E:\project\nov_web_mp\src\assets\iconfont\iconfont.svg

期望结果

可以正常编译

实际结果

编译报错(3:3) postcss-url: Image type is svg and link contains #. Postcss-url cant handle svg fragments. SVG file fully inlined. E:\project\nov_web_mp\src\assets\iconfont\iconfont.svg

环境信息

Taro CLI 3.5.11 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 16.14.0 - C:\Users\84441\AppData\Local\Temp\yarn--1686910179596-0.29573092973060056\node.CMD
      Yarn: 1.22.19 - C:\Users\84441\AppData\Local\Temp\yarn--1686910179596-0.29573092973060056\yarn.CMD
      npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD

补充信息

在config.index.js中的
h5:{
postcss:{
url:{
config:{
filter: () => {
return /^.*.(svg|png)$/;
}
}
}
}
}
增加这个后还是报错

j91ykkif

j91ykkif1#

Compiled with problems:X

WARNING in ./src/assets/iconfont/iconfont.css (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-4.use[0]!./node_modules/@tarojs/webpack5-runner/node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-5.use[0]!./src/assets/iconfont/iconfont.css)

Module Warning (from ./node_modules/@tarojs/webpack5-runner/node_modules/postcss-loader/dist/cjs.js):
Warning

(3:3) postcss-url: Image type is svg and link contains #. Postcss-url cant handle svg fragments. SVG file fully inlined. E:\project\nov_web_mp\src\assets\iconfont\iconfont.svg

WARNING in ./src/assets/iconfont/iconfont.css (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-4.use[0]!./node_modules/@tarojs/webpack5-runner/node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-5.use[0]!./src/assets/iconfont/iconfont.css)

Module Warning (from ./node_modules/@tarojs/webpack5-runner/node_modules/postcss-loader/dist/cjs.js):
Warning

(3:3) postcss-url: Image type is svg and link contains #. Postcss-url cant handle svg fragments. SVG file fully inlined. E:\project\nov_web_mp\src\assets\iconfont\iconfont.svg

相关问题