tcoopman / image-webpack-loader

Image loader module for webpack
MIT License
2.03k stars 132 forks source link

[webpack2] bypassOnDebug is required #90

Open jeanbza opened 7 years ago

jeanbza commented 7 years ago

We see errors when we don't provide it. This seems like a bad thing - should it be turned on by default?

    ERROR in ./~/pui-css-backgrounds/images/gray-cloud.png
    Module build failed: TypeError: Cannot read property 'bypassOnDebug' of null
        at Object.module.exports (<project>/src/main/resources/assets/node_modules/image-webpack-loader/index.js:30:26)
     @ ./~/css-loader!./~/sass-loader/lib/loader.js!./~/pui-css-backgrounds/backgrounds.css 6:63-97

    ERROR in ./~/pui-css-backgrounds/images/aboutus-hero.jpg
    Module build failed: TypeError: Cannot read property 'bypassOnDebug' of null
        at Object.module.exports (<project>/src/main/resources/assets/node_modules/image-webpack-loader/index.js:30:26)
     @ ./~/css-loader!./~/sass-loader/lib/loader.js!./~/pui-css-backgrounds/backgrounds.css 6:319-355
jeanbza commented 7 years ago

Fixing it simply requires switching from:

{
        test: /\.(jpe?g|png|gif|svg)$/i,
        loader: 'file-loader!image-webpack-loader'
      }

to

{
        test: /\.(jpe?g|png|gif|svg)$/i,
        loader: 'file-loader!image-webpack-loader&bypassOnDebug'
      }
adrienharnay commented 7 years ago

Can be closed, the PR has been merged