webpack2 在打包css时,css引用图片报错

ERROR in ./src/imgs/left.png
Module parse failed: C:\Users\Administrator\Desktop\test\src\imgs\left.png Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./~/css-loader!./src/css/banner.css 6:570-597
@ ./src/css/banner.css
@ ./src/js/index.js

ERROR in ./src/imgs/right.png
Module parse failed: C:\Users\Administrator\Desktop\test\src\imgs\right.png Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./~/css-loader!./src/css/banner.css 6:737-765
@ ./src/css/banner.css
@ ./src/js/index.js

我的webpack.config.js配置如下
var webpack=require('webpack');
module.exports={
entry:'./src/js/index.js',
output:{
path:__dirname+'/bundle',
filename:'[name].js'
},
module: {
rules: [
{
test: /.css$/,
use: ['style-loader','css-loader']
},
{
test:'/.(png|jpg|gif)$/',
use: [
{
loader: 'url-loader',
options: {
name: 'assets/[name]-[hash:5].[ext]',
limit: 4000
}
},
'image-webpack-loader'
]
}
]
}
}

请问大神为什么会报那样的错误 求指教

css

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问