Skip to content

Plugins - Source Map Documentation Conflicts #1556

Closed
@webpack-bot

Description

@webpack-bot

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
From https://webpack.js.org/configuration/devtool/

Instead of using the devtool option you can also use SourceMapDevToolPlugin / EvalSourceMapDevToolPlugin directly as it has more options. Never use both the devtool option and plugin together. The devtool option adds the plugin internally so you would end up with the plugin applied twice.

From https://webpack.js.org/plugins/source-map-dev-tool-plugin/

This plugin enables a more fine grained control of source maps added via the devtool option

The docs explicitly say don't use these together, but they also say that one is a fine-grained control of the source maps added via devtool.

  • ? If I don't use them together, how do I specify what kind of sourcemaps to use in the plugin since there isn't a devtool property in the options?
  • ? What is the preferred way to handle sourcemaps in webpack? Filename in output w/ devtool? filename specified via the plugin?

I'm using Webpack 3.4.1 with as many permutations of the possible configs (devtool, sourceMapDevToolPlugin) and cannot export source maps using "source-map".


This issue was moved from webpack/webpack#5591 by @sokra. Orginal issue was by @jtulk.

? If I don't use them together, how do I specify what kind of sourcemaps to use in the plugin since there isn't a devtool property in the options?

When using the SourceMapDevToolPlugin you don't need to use devtool.

cheap-source-map maps to columns: false
module-source-map maps to module: true
eval-source-map maps to EvalSourceMapDevToolPlugin

? What is the preferred way to handle sourcemaps in webpack? Filename in output w/ devtool? filename specified via the plugin?

devtool is the easy to use way. Plugin is the advanced way. Using devtool is recommended when possible.


When using a Plugin instead of the devtool option, this will render -p non-functional. You need to replace it with UglifyJsPlugin, DefinePlugin, etc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions