You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(plugins): update the source-map-devtool-plugin (#1707)
Clean up formatting a bit and add undocumented options from
webpack/webpack#5986. Update the external source maps example
to demonstrate path stripping.
Copy file name to clipboardExpand all lines: src/content/plugins/source-map-dev-tool-plugin.md
+39-6Lines changed: 39 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ related:
10
10
11
11
This plugin enables more fine grained control of source map generation. It is an alternative to the [`devtool`](/configuration/devtool/) configuration option.
12
12
13
-
```javascript
13
+
```js
14
14
newwebpack.SourceMapDevToolPlugin(options)
15
15
```
16
16
@@ -28,20 +28,26 @@ The following options are supported:
28
28
-`fallbackModuleFilenameTemplate` (`string`): See link above.
29
29
-`module` (`boolean`): Indicates whether loaders should generate source maps (defaults to `true`).
30
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.**
31
+
-`lineToLine` (`object`): Simplify and speed up source mapping by using line to line source mappings for matched modules.
32
+
-`publicPath` (`string`): Emits absolute URLs with public path prefix, e.g. `https://example.com/project/`.
33
+
-`fileContext` (`string`): Makes the `[file]` argument relative to this directory.
32
34
33
35
The `lineToLine` object allows for the same `test`, `include`, and `exclude` options described above.
34
36
37
+
The `fileContext` option is useful when you want to store source maps in an upper level directory to avoid `../../` appearing in the absolute `[url]`.
38
+
35
39
T> Setting `module` and/or `columns` to `false` will yield less accurate source maps but will also improve compilation performance significantly.
36
40
37
41
38
42
## Examples
39
43
44
+
The following examples demonstrate some common use cases for this plugin.
45
+
40
46
### Exclude Vendor Maps
41
47
42
48
The following code would exclude source maps for any modules in the `vendor.js` bundle:
43
49
44
-
```javascript
50
+
```js
45
51
newwebpack.SourceMapDevToolPlugin({
46
52
filename:'[name].js.map',
47
53
exclude: ['vendor.js']
@@ -52,9 +58,36 @@ new webpack.SourceMapDevToolPlugin({
52
58
53
59
Set a URL for source maps. Useful for hosting them on a host that requires authorization.
0 commit comments