Skip to content
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

New syntax for the image-file-loader in webpack2 #57

Open
smartcris opened this issue Sep 29, 2017 · 1 comment
Open

New syntax for the image-file-loader in webpack2 #57

smartcris opened this issue Sep 29, 2017 · 1 comment

Comments

@smartcris
Copy link

smartcris commented Sep 29, 2017

After the first yarn start I got several warnings:

WARNING in ./src/images/react_logo.svg
(Emitted value instead of an instance of Error) DEPRECATED. Configure gifsicle's interlaced option in its own options. (gifsicle.interlaced)
@ ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/resolve-url-loader!./node_modules/sass-loader/lib/loader.js?sourceMap!./src/styles/main.scss 6:4940-4977
@ ./src/styles/main.scss
@ ./src/index.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:3000 webpack/hot/dev-server react-hot-loader/patch webpack-dev-server/client?http://0.0.0.0:3000 webpack/hot/only-dev-server babel-polyfill whatwg-f......

I think you should update the loaders syntax in webpack 2 like so:


   test: /\.(gif|png|jpe?g|svg)$/i,
   use: [
      'file-loader', {
        loader: 'image-webpack-loader',
        options: {
          gifsicle: {
            interlaced: false,
          },
          optipng: {
            optimizationLevel: 7,
          },
          pngquant: {
            quality: '65-90',
            speed: 4
          },
          mozjpeg: {
            progressive: true,
            quality: 65
          },
          // Specifying webp here will create a WEBP version of your JPG/PNG images
          webp: {
            quality: 75
          }
        }
      }
    ]
@smartcris
Copy link
Author

Upgrading to Fiber I got this error:

Uncaught TypeError: Cannot read property 'instanceOf' of undefined
at eval (index.js:161)
at Object../node_modules/redbox-react/lib/index.js (app.529fd130306ecd1a2d53.js:5578)
at webpack_require (app.529fd130306ecd1a2d53.js:707)
at fn (app.529fd130306ecd1a2d53.js:112)
at eval (AppContainer.dev.js:13)
at Object../node_modules/react-hot-loader/lib/AppContainer.dev.js (app.529fd130306ecd1a2d53.js:4236)
at webpack_require (app.529fd130306ecd1a2d53.js:707)
at fn (app.529fd130306ecd1a2d53.js:112)
at Object.eval (AppContainer.js:8)
at eval (AppContainer.js:10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant