-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document new output.devtoolNamespace
option
#1653
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ contributors: | |
- irth | ||
- fvgs | ||
- dhurlburtusa | ||
- MagicDuck | ||
--- | ||
|
||
The top-level `output` key contains set of options instructing webpack on how and where it should output your bundles, assets and anything else you bundle or load with webpack. | ||
|
@@ -128,7 +129,7 @@ This option is only used when [`devtool`](/configuration/devtool) uses an option | |
Customize the names used in each source map's `sources` array. This can be done by passing a template string or function. For example, when using `devtool: 'eval'`, this is the default: | ||
|
||
``` js | ||
devtoolModuleFilenameTemplate: "webpack:///[resource-path]?[loaders]" | ||
devtoolModuleFilenameTemplate: "webpack://[namespace]/[resource-path]?[loaders]" | ||
``` | ||
|
||
The following substitutions are available in template strings (via webpack's internal [`ModuleFilenameHelpers`](https://github.com/webpack/webpack/blob/master/lib/ModuleFilenameHelpers.js)): | ||
|
@@ -142,6 +143,7 @@ The following substitutions are available in template strings (via webpack's int | |
| [loaders] | Explicit loaders and params up to the name of the first loader | | ||
| [resource] | The path used to resolve the file and any query params used on the first loader | | ||
| [resource-path] | The path used to resolve the file without any query params | | ||
| [namespace] | The modules namespace. This is usually the library name when building as a library, empty otherwise | | ||
|
||
When using a function, the same options are available camel-cased via the `info` parameter: | ||
|
||
|
@@ -153,6 +155,12 @@ devtoolModuleFilenameTemplate: info => { | |
|
||
If multiple modules would result in the same name, [`output.devtoolFallbackModuleFilenameTemplate`](#output-devtoolfallbackmodulefilenametemplate) is used instead for these modules. | ||
|
||
## `output.devtoolNamespace` | ||
|
||
`string` | ||
|
||
This option determines the modules namespace used with the [`output.devtoolModuleFilenameTemplate`](#output-devtoolmodulefilenametemplate). When not specified, it will default to the value of: [`output.library`](#output-library). It's use is to prevent source file path collisions in sourcemaps when loading multiple libraries built with webpack. | ||
For example, if you have 2 libraries, with namespaces `library1` and `library2`, which both have a file `./src/index.js` (with potentially different contents), they will expose these files as `webpack://library1/./src/index.js` and `webpack://library2/./src/index.js`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should add another line break to split this into two paragraphs. The way markdown is processed line 162 and 163 will be joined into one. |
||
|
||
## `output.filename` | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically add two line breaks before
h2
s.