tcoopman / image-webpack-loader

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

TypeError: Cannot read property 'end' of undefined #187

Open xuelq007 opened 5 years ago

xuelq007 commented 5 years ago

Is there anyone meet below problem?

Reproduce Steps:

  1. run webpack, it fails with below error log. the error happens in one less file about png file by background url: background: #02070C url(../assets/banner.png) no-repeat center center;
  2. then I do nothing to the less file and just resave it to reload webpack, it compiles successfully.

plugin version:
5.0.0

webpack version: 4.20.2

my webpack config:

            use: [
                {
                    loader: 'url-loader',
                    options: {
                        limit: 1000,
                        outputPath: 'assets',
                        name: '[name].[hash:8].[ext]'
                    }
                },
                {
                    loader: 'image-webpack-loader',
                    options: {
                        mozjpeg: {
                            progressive: true,
                            quality: 65
                        },
                        optipng: {
                            enabled: true
                        },
                        pngquant: {
                            quality: '65-90',
                            speed: 4
                        },
                        gifsicle: {
                            interlaced: false
                        }
                    }
                }
            ]
        }
    ]

Error Log:

ERROR in ./src/pages/test/test2019/assets/nodata.png Module build failed (from ./node_modules/image-webpack-loader/index.js): TypeError: Cannot read property 'end' of undefined at handleInput (/Users/me/byby/by/byby-portal/p-server-v2/node_modules/imagemin-pngquant/node_modules/execa/index.js:89:17) at module.exports (/Users/me/byby/by/byby-portal/p-server-v2/node_modules/imagemin-pngquant/node_modules/execa/index.js:309:2) at input (/Users/me/byby/by/byby-portal/p-server-v2/node_modules/imagemin-pngquant/index.js:52:13) at @ ./src/pages/test/test2019/myTicket/main.less (./node_modules/css-loader!./node_modules/less-loader/dist/cjs.js??ref--5-2!./src/pages/test/test2019/myTicket/main.less) 7:2845-2876

anikethsaha commented 4 years ago

You have any reproducible repo for it ? May be something to do with less-loader.