webpack: Error when trying to build bundle after upgrading to `4.20.0`

Bug report

What is the current behavior? When trying to build a js bundle and publish like we used to, webpack reported this error: /Users/***/Documents/work/repos/mobile-web/node_modules/webpack-cli/bin/config-yargs.js:89 describe: optionsSchema.definitions.output.properties.path.description, ^

TypeError: Cannot read property ‘properties’ of undefined

If the current behavior is a bug, please provide the steps to reproduce. it’s hard to give u the exact webpack.config.js because it our company’s project. But after analyze the problem, i find out that the problem may happen when webpack-cli@2.1.5 trying to work with webpack@4.20.0, some json may be not compatible with the older version. And after i downgrade my webpack to webpack@4.18.1, then there won’t be any error and the building can be done correctly.

What is the expected behavior?

Other relevant information: webpack version: 4.20.0 Node.js version: v10.8.0 Operating System: mac os high sierra 10.13.4 Additional tools:

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 60
  • Comments: 21 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Please read CHANGELOG https://github.com/webpack/webpack/releases/tag/v4.20.0

  • Update internal structure of options schema to generate typings
    • Note: this exposed an issue in webpack-cli, you need to upgrade to webpack-cli@3.1.1

Solution: upgrade webpack-cli to 3.1.1. Thanks for using webpack.

We had a same issue, when we had webpack combined with webpack-cli. Solved by using 4.19.1

"webpack": "4.19.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^2.1.4",
"webpack-merge": "^4.1.2"

Please update webpack-cli to latest version and use webpack-cli@3 for webpack@4.

You can also use 4.19.0 We have also noticed our builds were broken today (yesterday everything was fine) so it’s exactly the problem with update to 4.20.0

I am still having this issue with the following:

"webpack": "^4.29.6",
"webpack-cli": "^2.1.5"

For reference, my npm outdated ouput is:

$ npm outdated
Package                  Current   Wanted  Latest  
babel-loader               7.1.5    7.1.5   8.0.5  
css-loader               0.28.11  0.28.11   2.1.0  
file-loader               1.1.11   1.1.11   3.0.1  
file-saver                 1.3.8    1.3.8   2.0.1  
nodemailer                 4.7.0    4.7.0   5.1.1  
style-loader              0.21.0   0.21.0  0.23.1  
uglifyjs-webpack-plugin    1.3.0    1.3.0   2.1.2  
webpack-cli                2.1.5    2.1.5   3.2.3 

Is there a ‘definitive’ solution to this issue at this stage?

Maybe update webpack-cli to 3.2.3?

Like this?

npm install --save-dev webpack-cli@latest

Or maybe this?

npm install --save-dev webpack-cli@3.2.3

Thank you.

Edit: I am no expert, but this seemed to work for me:

npm install --save-dev webpack-cli@3.2.3

I’m unhappy with the proposed solution because

  1. it introduces breaking change on minor version update
  2. updating webpack-cli forces me to add dependency to deprecated (!) babel-preset-es2015. With older webpack-cli the build was happy with babel-preset-env which is recommended on their page (https://www.npmjs.com/package/babel-preset-es2015)

A patch with backwards compatibility would be great. 👍

Making a mistake is one thing, but letting this continue to break people’s applications for more than 2 months seems irresponsible.

https://github.com/webpack/webpack/issues/8450

Same here

[bundle] /usr/src/app/node_modules/webpack-cli/bin/config-yargs.js:89 [bundle] describe: optionsSchema.definitions.output.properties.path.description, [bundle] ^ [bundle] [bundle] TypeError: Cannot read property ‘properties’ of undefined [bundle] at module.exports (/usr/src/app/node_modules/webpack-cli/bin/config-yargs.js:89:48) [bundle] at /usr/src/app/node_modules/webpack-cli/bin/webpack.js:60:27 [bundle] at Object.<anonymous> (/usr/src/app/node_modules/webpack-cli/bin/webpack.js:515:3) [bundle] at Module._compile (internal/modules/cjs/loader.js:689:30) [bundle] at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10) [bundle] at Module.load (internal/modules/cjs/loader.js:599:32) [bundle] at tryModuleLoad (internal/modules/cjs/loader.js:538:12) [bundle] at Function.Module._load (internal/modules/cjs/loader.js:530:3) [bundle] at Module.require (internal/modules/cjs/loader.js:637:17) [bundle] at require (internal/modules/cjs/helpers.js:20:18)

Works after update of webpack-cli to latest!

it is bug in webpack-cli, not in webpack (so no need to use major release)

While technically correct, this version update caused a breaking change what is by far the most common configuration where Webpack is used–alongside the CLI. As indicated by all the linked issues above, this caused some majors issues for a large number of people, including some of our customers! Is there any way a patch version can be published with backwards-compatibility with the previous version of the webpack-cli?