Skip to content

Commit bdf4dbb

Browse files
pierreneterskipjack
authored andcommitted
docs(config): correct substitutions in output.md (#1487)
Correct `output.filename` substitutions and move the others to `output.sourceMapFilename`. Also fix `related` link in the context- replacement-plugin. Fixes #1467
1 parent 1fdd547 commit bdf4dbb

File tree

3 files changed

+242
-63
lines changed

3 files changed

+242
-63
lines changed

content/configuration/output.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ The following substitutions are available in template strings (via webpack's int
206206
| [chunkhash] | The hash of the chunk content |
207207
| [name] | The module name |
208208
| [id] | The module identifier |
209-
| [file] | The module filename |
210-
| [filebase] | The module [basename](https://nodejs.org/api/path.html#path_path_basename_path_ext) |
211209
| [query] | The module query, i.e., the string following `?` in the filename |
212210

213211
The lengths of `[hash]` and `[chunkhash]` can be specified using `[hash:16]` (defaults to 20). Alternatively, specify [`output.hashDigestLength`](#output-hashdigestlength) to configure the length globally.
@@ -617,7 +615,12 @@ This option is only used when [`devtool`](/configuration/devtool) uses a SourceM
617615

618616
Configure how source maps are named. By default `"[file].map"` is used.
619617

620-
Technically, the `[name]`, `[id]`, `[hash]` and `[chunkhash]` [placeholders](#output-filename) can be used, if generating a SourceMap for chunks. In addition to that, the `[file]` placeholder is replaced with the filename of the original file. It's recommended to only use the `[file]` placeholder, as the other placeholders won't work when generating SourceMaps for non-chunk files. Best leave the default.
618+
The `[name]`, `[id]`, `[hash]` and `[chunkhash]` substitions from [#output-filename](#output-filename) can be used. In addition to those, you can use substitutions listed below. The `[file]` placeholder is replaced with the filename of the original file. We recommend __only using the `[file]` placeholder__, as the other placeholders won't work when generating SourceMaps for non-chunk files.
619+
620+
| Template | Description |
621+
| -------------------------- | ----------------------------------------------------------------------------------- |
622+
| [file] | The module filename |
623+
| [filebase] | The module [basename](https://nodejs.org/api/path.html#path_path_basename_path_ext) |
621624

622625

623626
## `output.sourcePrefix`

content/plugins/context-replacement-plugin.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: ContextReplacementPlugin
33
contributors:
44
- simon04
55
related:
6-
- title: Issue #2783 - ContextReplacementPlugin Description
7-
- url: https://github.com/webpack/webpack/issues/2783#issuecomment-234137265
6+
- title: Issue 2783 - ContextReplacementPlugin Description
7+
url: https://github.com/webpack/webpack/issues/2783#issuecomment-234137265
88
---
99

1010
*Context* refers to a [require with an expression](/guides/dependency-management/#require-with-expression) such as `require('./locale/' + name + '.json')`. When encountering such an expression, webpack infers the directory (`'./locale/'`) and a regular expression (`/^.*\.json$/`). Since the `name` is not known at compile time, webpack includes every file as module in the bundle.

0 commit comments

Comments
 (0)