Skip to content

Commit 9cd50d5

Browse files
authored
docs(plugins): clarify and simplify SourceMapDevToolPlugin docs (#1581)
Try to resolve the confusion from #1556. Also update the options section to clean things up a bit both for readability and grammar. Resolves #1556
1 parent 3f5c3fb commit 9cd50d5

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/content/plugins/source-map-dev-tool-plugin.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ related:
88
url: https://survivejs.com/webpack/building/source-maps/#-sourcemapdevtoolplugin-and-evalsourcemapdevtoolplugin-
99
---
1010

11-
This plugin enables a more fine grained control of [source maps added via the `devtool` option](/configuration/devtool/).
11+
This plugin enables more fine grained control of source map generation. It is an alternative to the [`devtool`](/configuration/devtool/) configuration option.
1212

1313
```javascript
1414
new webpack.SourceMapDevToolPlugin(options)
@@ -19,13 +19,20 @@ new webpack.SourceMapDevToolPlugin(options)
1919

2020
The following options are supported:
2121

22-
* `options.test` / `options.include` / `options.exclude` (`string|RegExp|Array`): Used to determine which assets should be processed. Each one can be a `RegExp` (asset filename is matched), a `string` (asset filename need to start with this string) or an `Array` of those (any of them need to be matched). `test` defaults to `.js` and `.css` files if omitted.
23-
* `options.filename` (`string`): defines the output filename of the SourceMap. If no value is provided the source map is inlined.
24-
* `options.append` (`string`): is appended to the original asset. Usually the `#sourceMappingURL` comment. `[url]` is replaced with a URL to the source map file. `false` disables the appending.
25-
* `options.moduleFilenameTemplate` / `options.fallbackModuleFilenameTemplate` (`string`): see [`output.devtoolModuleFilenameTemplate`](/configuration/output/#output-devtoolmodulefilenametemplate).
26-
* `options.module` (`boolean`): (defaults to `true`) When `false` loaders do not generate source maps and the transformed code is used as source instead.
27-
* `options.columns` (`boolean`): (defaults to `true`) When `false` column mappings in source maps are ignored and a faster source map implementation is used.
28-
* `options.lineToLine` (`{test: string|RegExp|Array, include: string|RegExp|Array, exclude: string|RegExp|Array}` matched modules uses simple (faster) line to line source mappings.
22+
- `test` (`string|regex|array`): Include source maps for modules based on their extension (defaults to `.js` and `.css`).
23+
- `include` (`string|regex|array`): Include source maps for module paths that match the given value.
24+
- `exclude` (`string|regex|array`): Exclude modules that match the given value from source map generation.
25+
- `filename` (`string`): Defines the output filename of the SourceMap (will be inlined if no value is provided).
26+
- `append` (`string`): Appends the given value to the original asset. Usually the `#sourceMappingURL` comment. `[url]` is replaced with a URL to the source map file. `false` disables the appending.
27+
- `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/configuration/output/#output-devtoolmodulefilenametemplate).
28+
- `fallbackModuleFilenameTemplate` (`string`): See link above.
29+
- `module` (`boolean`): Indicates whether loaders should generate source maps (defaults to `true`).
30+
- `columns` (`boolean`): Indicates whether column mappings should be used (defaults to `true`).
31+
- `lineToLine` (`object`): Simplify and speed up source mapping by using line to line source mappings for matched modules.**
32+
33+
The `lineToLine` object allows for the same `test`, `include`, and `exclude` options described above.
34+
35+
T> Setting `module` and/or `columns` to `false` will yield less accurate source maps but will also improve compilation performance significantly.
2936

3037

3138
## Usage: Exclude Vendor Maps

0 commit comments

Comments
 (0)