Skip to content

Commit dc01b1c

Browse files
authored
docs(plugins): document append function (#6916)
* docs(plugins): document append function * Apply suggestions from code review
1 parent 6c6a10b commit dc01b1c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/content/plugins/eval-source-map-dev-tool-plugin.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ The following options are supported:
2929
- `test` (`string|RegExp|array`): Include source maps for modules based on their extension (defaults to `.js` and `.css`).
3030
- `include` (`string|RegExp|array`): Include source maps for module paths that match the given value.
3131
- `exclude` (`string|RegExp|array`): Exclude modules that match the given value from source map generation.
32-
- `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.
32+
- `append` (`string|function`): 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.
33+
34+
Starting from version 5.84.0, webpack allows the `append` option to be a function that accepts path data and an asset info object as arguments, and returns a string.
35+
36+
```ts
37+
(pathData: PathData, assetInfo?: AssetInfo) => string;
38+
```
39+
3340
- `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/configuration/output/#outputdevtoolmodulefilenametemplate).
3441
- `module` (`boolean`): Indicates whether loaders should generate source maps (defaults to `true`).
3542
- `columns` (`boolean`): Indicates whether column mappings should be used (defaults to `true`).

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ The following options are supported:
2727
- `include` (`string` `RegExp` `[string, RegExp]`): Include source maps for module paths that match the given value.
2828
- `exclude` (`string` `RegExp` `[string, RegExp]`): Exclude modules that match the given value from source map generation.
2929
- `filename` (`string`): Defines the output filename of the SourceMap (will be inlined if no value is provided).
30-
- `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. Since webpack v4.36.0, path parameters are supported: `[chunk]`, `[filename]` and `[contenthash]`. Setting `append` to `false` disables the appending.
30+
- `append` (`string` `function`): Appends the given value to the original asset. Usually the `#sourceMappingURL` comment. `[url]` is replaced with a URL to the source map file. Since webpack v4.36.0, path parameters are supported: `[chunk]`, `[filename]` and `[contenthash]`. Setting `append` to `false` disables the appending.
31+
32+
Starting from version 5.84.0, webpack allows the `append` option to be a function that accepts path data and an asset info object as arguments, and returns a string.
33+
34+
```ts
35+
(pathData: PathData, assetInfo?: AssetInfo) => string;
36+
```
37+
3138
- `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/configuration/output/#outputdevtoolmodulefilenametemplate).
3239
- `fallbackModuleFilenameTemplate` (`string`): See link above.
3340
- `namespace` (`string`): See [`output.devtoolNamespace`](/configuration/output/#outputdevtoolnamespace).

0 commit comments

Comments
 (0)