From 60ed52941ca08f171ea90b8ad33a583672341dfb Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 17 Apr 2024 10:17:37 +0800 Subject: [PATCH] docs: update SourceMapDevToolPlugin en --- .../webpack/source-map-dev-tool-plugin.mdx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx b/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx index 3754ae3c16b..554339ee09f 100644 --- a/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx +++ b/website/docs/en/plugins/webpack/source-map-dev-tool-plugin.mdx @@ -12,20 +12,28 @@ new rspack.SourceMapDevToolPlugin(options); ## Options -- `test` (`string` `RegExp` `[string, RegExp]`): Include source maps for modules based on their extension (defaults to .js, .mjs, and .css). +- `test` (`string` `RegExp` `[string, RegExp]`): Include source maps for modules based on their extension (defaults to `.js`, `.mjs`, and `.css`). - `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` `function`): Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. 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. Path parameters are supported: `[chunk]`, `[filename]` and `[contenthash]`. Setting append to false disables the appending. - `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/en/config/output.html#outputdevtoolmodulefilenametemplate). - `fallbackModuleFilenameTemplate` (`string`): See link above. - `namespace` (`string`): See [`output.devtoolNamespace`](/en/config/output.html#outputdevtoolnamespace). - `module = true` (`boolean`): Indicates whether loaders should generate source maps. - `columns = true` (`boolean`): Indicates whether column mappings should be used. - `noSources = false` (`boolean`): Prevents the source file content from being included in the source map. -- `publicPath` (`string`): Emits absolute URLs with public path prefix, e.g. https://example.com/project/. -- `fileContext` (`string`): Makes the [file] argument relative to this directory. -- `sourceRoot` (`string`): Provide a custom value for the sourceRoot property in the SourceMap. +- `publicPath` (`string`): Emits absolute URLs with public path prefix, e.g. `https://example.com/project/`. +- `fileContext` (`string`): Makes the `[file]` argument relative to this directory. +- `sourceRoot` (`string`): Provide a custom value for the `sourceRoot` property in the SourceMap. + +:::tip +Setting `module` and/or `columns` to `false` will yield less accurate source maps but will also improve compilation performance significantly. +::: + +:::tip +If you want to use a custom configuration for this plugin in [development mode](/config/mode#development), make sure to disable the default one. I.e. set `devtool: false`. +::: ## Examples