Skip to content

Cannot read property 'length' of undefined #36

@sacredMonster

Description

@sacredMonster

Hello,
My project uses webpack@3.10.0 and I am seeing the below error when I run webpack -p command to build my project.

ERROR in ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./stylesheets/main.scss
Module build failed: TypeError: Cannot read property 'length' of undefined
    at module.exports (..\node_modules\postcss-value-parser\lib\unit.js:7:23)
    at ..\node_modules\css-loader\node_modules\postcss-minify-gradients\dist\index.js:65:65
    at Array.forEach (native)
    at ..\node_modules\css-loader\node_modules\postcss-minify-gradients\dist\index.js:60:22

Here is my webpack.config.js:

module: [
     {
        test: /\.scss$/,
        include: APP_DIR,
        loaders: ['style-loader', 'css-loader', 'sass-loader'],
      },

I have a potential fix in place in unit.js which removes the above error:

module.exports = function (value) {
    var pos = 0;
    var length = Object.prototype.toString(value) === '[object Array]'
        ? value.length
        : 0;
...
}

Do you think this is a valid fix? If yes, I can send a PR for this..
Thanks..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions