Schadenn
Schadenn

Reputation: 934

Webpack devtool="(none)" breaks my code

I'm using webpack 3.10 and I've got different webpack configs for dev/prod. Now in my prod config "devtool = "(none)"" is set, while in my dev config it is "eval-source-map".

Sadly using the prod config, my bundle is non functional. While using the dev config everything is working fine. I tried around a bit and every setting that is flagged as "production: yes" on in the webpack docs: https://webpack.js.org/configuration/devtool/ breaks my code.

Can anyone explain the exact difference between the settings. Is there anything else that changes (minifying/uglyfying whatever)?

Kind regards.

Upvotes: 19

Views: 10148

Answers (2)

Noopur Phalak
Noopur Phalak

Reputation: 969

In webpack 5.2.0, you can declare the config as devtool: false in production for the (none) functionality.

NOTE: If you have mode: "development" and you do not mention devtool in your webpack config, the devtool defaults to eval.

Upvotes: 33

Gabriel Bueno
Gabriel Bueno

Reputation: 520

That's not how you use it. To make it work, you shouldn't specify a devtool key. Not a null value or (none), you simply shouldn't have the devtool key on your configuration.

{
  ...
  plugins: [],
  optimization: {}
  ...
}

Without any devtool in between.

Upvotes: 0

Related Questions