關(guān)于image-webpack-loader的問題,看來源碼也沒找出來問題,最后還是用的img-loader
ERROR in ./src/assets/1.jpg
Module build failed: TypeError: Cannot read property 'bypassOnDebug' of null
? ? at Object.module.exports (F:\webpack\webpack-demo1\node_modules\image-webpack-loader\index.js:30:26)
2017-04-30
The?LoaderOptionsPlugin?is to make the transition from webpack 1 easier. In webpack 2 you should define the options directly on the loader.
Your rule would look like this (using the webpack 2 rule from the README with your options):
{
? ?test: /\.(gif|png|jpe?g|svg)$/i,
? ?use: [
? ? ? ?'file-loader',
? ? ? ?{
? ? ? ? ? ?loader: 'image-webpack-loader',
? ? ? ? ? ?options: {
? ? ? ? ? ? ? ?mozjpeg: {
? ? ? ? ? ? ? ? ? ?quality: 65,
? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ?pngquant: {
? ? ? ? ? ? ? ? ? ?quality: '65-90',
? ? ? ? ? ? ? ? ? ?speed: 4,
? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ?svgo: {
? ? ? ? ? ? ? ? ? ?plugins: [
? ? ? ? ? ? ? ? ? ? ? ?{
? ? ? ? ? ? ? ? ? ? ? ? ? ?removeViewBox: false,
? ? ? ? ? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ? ? ? ? ?{
? ? ? ? ? ? ? ? ? ? ? ? ? ?removeEmptyAttrs: false,
? ? ? ? ? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ? ? ?],
? ? ? ? ? ? ? ?}
? ? ? ? ? ?}
? ? ? ?}
? ?]}
2017-04-25
一運(yùn)行也是爆這個錯
如果寫成這樣image-webpack-loader?bypassOnDebug,他直接notfounderror了

2017-04-13
'image-webpack-loader?bypassOnDebug' 建議看一下npm上的描述。https://www.npmjs.com/package/image-webpack-loader
2017-04-08
同問這個問題,嘗試過使用img-loader可以正常編譯,是可以壓縮圖片的
2017-04-01
同問這個問題,嘗試過使用img-loader可以正常編譯,但是沒有壓縮圖片。