weex -vv1.3.11在webpack 里面添加{ test: /\.(jpg|jpeg|gif|png)$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
name: 'img/[name].[sha512:hash:base64:7].[ext]'
},
}], exclude: config.excludeModuleReg},web环境能看到它变成了base64, 并且能使用运行npm run andriod 或者 npm run ios报错WARNING in ./src/images/index/icon-close.png Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type.自行 npm install url-loader file-loader 也没用
1 回答
守着星空守着你
TA贡献1799条经验 获得超8个赞
在 webpack.common.conf.js
// Config for compile jsbundle for native.const weexConfig = {...{ test: /\.(png|jp(e*)g|svg)$/, use: [{ loader: 'url-loader', options: { limit: 10000, // Convert images < 10kb to base64 strings name: 'images/[name].[ext]' } }] }
以前是因为写到webConfig里去了。
添加回答
举报
0/150
提交
取消