Skip to content

Commit

Permalink
docs(plugins): document append function (#6916)
Browse files Browse the repository at this point in the history
* docs(plugins): document append function

* Apply suggestions from code review
  • Loading branch information
chenxsan authored Jun 18, 2023
1 parent 6c6a10b commit dc01b1c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/content/plugins/eval-source-map-dev-tool-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ The following options are supported:
- `test` (`string|RegExp|array`): Include source maps for modules based on their extension (defaults to `.js` and `.css`).
- `include` (`string|RegExp|array`): Include source maps for module paths that match the given value.
- `exclude` (`string|RegExp|array`): Exclude modules that match the given value from source map generation.
- `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.
- `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.

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.

```ts
(pathData: PathData, assetInfo?: AssetInfo) => string;
```

- `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/configuration/output/#outputdevtoolmodulefilenametemplate).
- `module` (`boolean`): Indicates whether loaders should generate source maps (defaults to `true`).
- `columns` (`boolean`): Indicates whether column mappings should be used (defaults to `true`).
Expand Down
9 changes: 8 additions & 1 deletion src/content/plugins/source-map-dev-tool-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ The following options are supported:
- `include` (`string` `RegExp` `[string, RegExp]`): Include source maps for module paths that match the given value.
- `exclude` (`string` `RegExp` `[string, RegExp]`): Exclude modules that match the given value from source map generation.
- `filename` (`string`): Defines the output filename of the SourceMap (will be inlined if no value is provided).
- `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.
- `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.

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.

```ts
(pathData: PathData, assetInfo?: AssetInfo) => string;
```

- `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/configuration/output/#outputdevtoolmodulefilenametemplate).
- `fallbackModuleFilenameTemplate` (`string`): See link above.
- `namespace` (`string`): See [`output.devtoolNamespace`](/configuration/output/#outputdevtoolnamespace).
Expand Down

0 comments on commit dc01b1c

Please sign in to comment.