Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onfiguration.devtool should match pattern "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$"

Tags:

webpack

I am migrating webpack 4 to webpack 5.

config/webpack.js has:

`devtool: isProduction ? 'hidden-source-map' : 'cheap-module-eval-source-map'

after migration got error:

onfiguration.devtool should match pattern "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$".

It looks like the new webpack don't like conditions, because if I change to:

devtool: 'hidden-source-map'

error is gone.

like image 759
Edgaras Karka Avatar asked Jan 29 '21 11:01

Edgaras Karka


2 Answers

problem was with cheap-module-eval-source-map -> eval-cheap-module-source-map according by https://webpack.js.org/configuration/devtool/

like image 139
Edgaras Karka Avatar answered Sep 20 '22 16:09

Edgaras Karka


Webpack V5 expects a certain pattern when validating devtool name, failing to match the pattern mixing up the sequence of devtool string can cause error. The pattern is: [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map.

So for example, one of the following options can be used in webpack configuration file that are in Development phase - devtool: 'eval' devtool: 'eval-source-map' devtool: 'eval-cheap-source-map' devtool: 'eval-cheap-module-source-map'

These changes are new and thus when using an old configuration file such error can pop up. Reset the devtool value to the matching pattern and the error will go away. To learn more about devtool values suitable for your work visit Webpack Devtool Documentation

like image 34
RaihanShezan Avatar answered Sep 17 '22 16:09

RaihanShezan