Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 563
Schadenn Avatar asked Jul 05 '18 15:07

Schadenn


People also ask

What is Devtool in Webpack?

Using Webpack, specifying devtool: "source-map" in your Webpack config will enable source maps, and Webpack will output a sourceMappingURL directive in your final, minified file.

How do I use Sourcemap in Webpack?

If we aim to use source map in production, we can use source-map value for devtool . module. exports = { mode: "development", devtool: "source-map", }; Here, webpack stores the source map in a different file.


1 Answers

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.

like image 159
Noopur Phalak Avatar answered Sep 20 '22 03:09

Noopur Phalak