-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
打包后img中src值的问题 #23
Comments
webpack.config.js const webpack = require('webpack') module.exports = { output: { module: {
}, plugins: [ optimization: { devServer: { |
添加 esModule: false 即可,如下 rules: [
{
test: /\.jpg|png|gif|bmp|ttf|eot|svg|woff|woff2$/,
// 小于等于 limit 大小的图片会被转为 base64
use: [{
loader: 'url-loader?limit=272359',
options: {
esModule: false
}
}],
test: /\.jpg|png|gif|bmp|ttf|eot|svg|woff|woff2$/,
},
] |
html中 img src="images/img.jpg" alt=""
编译后结果
img src="{"default":"images/cceba3bc9c3a59cc3e8fffa8959907f1.jpg"}" alt=""
1、使用版本0.1.16
2、wepcck.config.js配置
module:{
rules: [
{
test: /.(htm|html)$/i,
loader: 'html-withimg-loader'
}
]
}
The text was updated successfully, but these errors were encountered: