From 3066881a14b4d14bf4f23cac316f85d3c938934d Mon Sep 17 00:00:00 2001 From: Stephan Badragan Date: Wed, 18 Oct 2017 00:49:34 +0100 Subject: [PATCH 1/5] adding docs for new `output.devtoolNamespace` option and [namespace] placeholder --- src/content/configuration/output.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 36ce4222c04b..04b366f064a9 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -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`. ## `output.filename` From 549cd38374da18d983095ec21942c575c88b5d8a Mon Sep 17 00:00:00 2001 From: Stephan Badragan Date: Fri, 20 Oct 2017 20:47:06 +0100 Subject: [PATCH 2/5] adding extra lines as indicated --- src/content/configuration/output.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 04b366f064a9..1c6cc9349bef 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -155,13 +155,16 @@ 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`. + ## `output.filename` `string` From 1e7c986e49349ca7936925146c0e3810ffb778fa Mon Sep 17 00:00:00 2001 From: EugeneHlushko Date: Sun, 24 Dec 2017 17:15:51 +0200 Subject: [PATCH 3/5] Update docs according to feature introduced in latest webpack. --- src/content/configuration/output.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 1c6cc9349bef..0a408861fa5e 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -236,8 +236,16 @@ The prefix length of the hash digest to use, defaults to `20`. ## `output.hashFunction` +`string|function` + The hashing algorithm to use, defaults to `'md5'`. All functions from Node.JS' [`crypto.createHash`](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) are supported. +Since v4.0.0-alpha2 `hashFunction` can now be a constructor to a custom hash function. You can provide a non-crypto hash function for performance reasons. + +``` js +hashFunction: require('metrohash').MetroHash64 +``` +Make sure that hashing function will have `update` and `digest` methods available. ## `output.hashSalt` From 83fb28d185a4d16ff7d96f149dc119737b459d2c Mon Sep 17 00:00:00 2001 From: EugeneHlushko Date: Tue, 9 Jan 2018 10:54:09 +0200 Subject: [PATCH 4/5] Update docs according to feature introduced in latest webpack: PR changes --- src/content/configuration/output.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 0a408861fa5e..59891aec151a 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -160,7 +160,7 @@ If multiple modules would result in the same name, [`output.devtoolFallbackModul `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. +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 used 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`. @@ -245,7 +245,7 @@ Since v4.0.0-alpha2 `hashFunction` can now be a constructor to a custom hash fun hashFunction: require('metrohash').MetroHash64 ``` -Make sure that hashing function will have `update` and `digest` methods available. +Make sure that the hashing function will have `update` and `digest` methods available. ## `output.hashSalt` From 1b80d22ed53abf47a5059d37f9c2a6166d8a1b47 Mon Sep 17 00:00:00 2001 From: Greg Venech Date: Tue, 16 Jan 2018 01:02:42 -0500 Subject: [PATCH 5/5] docs(config): minor formatting tweaks --- src/content/configuration/output.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 59891aec151a..f11dc1d40828 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -238,8 +238,7 @@ The prefix length of the hash digest to use, defaults to `20`. `string|function` -The hashing algorithm to use, defaults to `'md5'`. All functions from Node.JS' [`crypto.createHash`](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) are supported. -Since v4.0.0-alpha2 `hashFunction` can now be a constructor to a custom hash function. You can provide a non-crypto hash function for performance reasons. +The hashing algorithm to use, defaults to `'md5'`. All functions from Node.JS' [`crypto.createHash`](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) are supported. Since `4.0.0-alpha2`, the `hashFunction` can now be a constructor to a custom hash function. You can provide a non-crypto hash function for performance reasons. ``` js hashFunction: require('metrohash').MetroHash64