5

I am in the process of upgrading webpack from v4 to v5.

I have started with upgrading webpack-cli, as explained in the doc.

So when I run npx webpack --version I get

webpack 4.46.0
webpack-cli 4.5.0

Now I try to run the following command : npx webpack --display-error-details. The documentation of the webpack cli for v4 says this option is available.

But I get Error: Unknown option '--display-error-details'

What am I missing?

tmhao2005
  • 14,776
  • 2
  • 37
  • 44
Istopopoki
  • 1,584
  • 1
  • 13
  • 20

2 Answers2

11

For the version 5.x of webpack you have to specify stats.errorDetails to true at the webpack config, like follows:

const customConfig = {
   stats: {
      errorDetails: true,
      children: true
   },
}
Малъ Скрылевъ
  • 16,187
  • 5
  • 56
  • 69
8

As I know that from the webpack-cli ^4.x (which works with webpack v5) this option is deprecated which means this option is only available at lower version such as ^3.x version.

So in order to work with ^4.x, you might check all the available options here to find what you need or you can npx webpack --help.

tmhao2005
  • 14,776
  • 2
  • 37
  • 44