sx2asdf31415 2017-04-06 07:58 采纳率: 0%
浏览 6965

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'
]
}
]
}
}

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

  • 写回答

1条回答

  • 风君子_ol 2017-08-14 07:31
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog