From c19a2fcd1e264e4242e6dded1bc530a131f3e1f2 Mon Sep 17 00:00:00 2001 From: QC-L Date: Tue, 15 Sep 2020 21:20:07 +0800 Subject: [PATCH 1/6] docs(config): add new option `workerChunkLoading` for output --- src/content/configuration/output.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 2d2a171fc212..79b7b6777956 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -24,6 +24,7 @@ contributors: - hiroppy - chenxsan - snitin315 + - QC-L --- 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. @@ -1133,6 +1134,23 @@ module.exports = { }; ``` +## `output.workerChunkLoading` + +`string` `boolean = false` + +The new option `workerChunkLoading` controls the chunk loading of workers (default chosen based on output.chunkLoading). + +The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins). + + +```javascript +module.exports = { + output: { + workerChunkLoading: false // false | "jsonp" | "import-scripts" | "require" | "async-node" + } +} +``` + ## `output.enabledLibraryTypes` `[string]` From 1079489fb697fd9f7ab5a633d58e1f8f8cbe1167 Mon Sep 17 00:00:00 2001 From: QC-L Date: Tue, 15 Sep 2020 22:51:08 +0800 Subject: [PATCH 2/6] docs: change options value and add tips --- src/content/configuration/output.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 79b7b6777956..138f88f691da 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -1136,17 +1136,20 @@ module.exports = { ## `output.workerChunkLoading` -`string` `boolean = false` +`string = 'require' | 'import-scripts' | 'async-node' | 'universal'` `boolean: false` The new option `workerChunkLoading` controls the chunk loading of workers (default chosen based on output.chunkLoading). The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins). +T> The default value of this option changes when `target` is different. For more details, see [`output.workerChunkLoading` default value](https://github.com/webpack/webpack/blob/2c00413b26b266d4bf9fd2d68a13769837908461/lib/config/defaults.js#L604) and [new `target.js`](https://github.com/webpack/webpack/blob/2c00413b26b266d4bf9fd2d68a13769837908461/lib/config/target.js#L64) + +__webpack.config.js__ ```javascript module.exports = { output: { - workerChunkLoading: false // false | "jsonp" | "import-scripts" | "require" | "async-node" + workerChunkLoading: false } } ``` From 16b6b2906c85f2d9a6fdff726bfd08d0fea96d02 Mon Sep 17 00:00:00 2001 From: QC-L Date: Tue, 15 Sep 2020 23:21:54 +0800 Subject: [PATCH 3/6] chore: rm redundant content --- src/content/configuration/output.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 138f88f691da..ed247c8e4b88 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -1136,13 +1136,11 @@ module.exports = { ## `output.workerChunkLoading` -`string = 'require' | 'import-scripts' | 'async-node' | 'universal'` `boolean: false` +`string = 'require' | 'import-scripts' | 'async-node' | 'import' | 'universal'` `boolean: false` -The new option `workerChunkLoading` controls the chunk loading of workers (default chosen based on output.chunkLoading). +The new option `workerChunkLoading` controls the chunk loading of workers. -The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins). - -T> The default value of this option changes when `target` is different. For more details, see [`output.workerChunkLoading` default value](https://github.com/webpack/webpack/blob/2c00413b26b266d4bf9fd2d68a13769837908461/lib/config/defaults.js#L604) and [new `target.js`](https://github.com/webpack/webpack/blob/2c00413b26b266d4bf9fd2d68a13769837908461/lib/config/target.js#L64) +T> The default value of this option changes when `target` is different. For more details, see [`output.workerChunkLoading` default value](https://github.com/webpack/webpack/blob/master/lib/config/defaults.js#L604) and [`target.js`](https://github.com/webpack/webpack/blob/master/lib/config/target.js#L64). __webpack.config.js__ From 50e93f8b14c8e5e07e8336d98b4eed4d00f6df82 Mon Sep 17 00:00:00 2001 From: QC-L Date: Tue, 15 Sep 2020 23:24:04 +0800 Subject: [PATCH 4/6] fix: lint error --- src/content/configuration/output.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index ed247c8e4b88..8ac3bac8f7cd 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -1146,10 +1146,11 @@ __webpack.config.js__ ```javascript module.exports = { + //... output: { workerChunkLoading: false } -} +}; ``` ## `output.enabledLibraryTypes` From 361ab1f3d16bdf0f18b61ecc19d41ac5ffc139be Mon Sep 17 00:00:00 2001 From: QiChang Li Date: Mon, 28 Sep 2020 17:09:19 +0800 Subject: [PATCH 5/6] Update src/content/configuration/output.md Co-authored-by: Eugene Hlushko --- src/content/configuration/output.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index 8ac3bac8f7cd..bf6f6818ad6d 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -1136,7 +1136,7 @@ module.exports = { ## `output.workerChunkLoading` -`string = 'require' | 'import-scripts' | 'async-node' | 'import' | 'universal'` `boolean: false` +`string: 'require' | 'import-scripts' | 'async-node' | 'import' | 'universal'` `boolean: false` The new option `workerChunkLoading` controls the chunk loading of workers. From bfa0078db577c6f91489f5ac304faa25c623c3bb Mon Sep 17 00:00:00 2001 From: QiChang Li Date: Mon, 28 Sep 2020 17:12:44 +0800 Subject: [PATCH 6/6] Update src/content/configuration/output.md --- src/content/configuration/output.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/configuration/output.md b/src/content/configuration/output.md index bf6f6818ad6d..9e59ef089bc9 100644 --- a/src/content/configuration/output.md +++ b/src/content/configuration/output.md @@ -1140,7 +1140,7 @@ module.exports = { The new option `workerChunkLoading` controls the chunk loading of workers. -T> The default value of this option changes when `target` is different. For more details, see [`output.workerChunkLoading` default value](https://github.com/webpack/webpack/blob/master/lib/config/defaults.js#L604) and [`target.js`](https://github.com/webpack/webpack/blob/master/lib/config/target.js#L64). +T> The default value of this option is depending on the `target` setting. For more details, search for `"workerChunkLoading"`: [in the webpack defaults](https://github.com/webpack/webpack/blob/master/lib/config/defaults.js). __webpack.config.js__