From decb0742ca48c1db9951999c1e9fc2b805867d90 Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Fri, 20 Mar 2026 17:50:34 +0530 Subject: [PATCH 1/8] docs: improve explanation of configuration defaults for dev and prod modes --- src/content/contribute/writers-guide.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/contribute/writers-guide.mdx b/src/content/contribute/writers-guide.mdx index d868007beeab..78abcc0f811a 100644 --- a/src/content/contribute/writers-guide.mdx +++ b/src/content/contribute/writers-guide.mdx @@ -154,6 +154,7 @@ Please do not assume things are simple. Avoid words like 'just', 'simply'. ``` ### Configuration defaults and types +Webpack configuration defaults can vary depending on the selected mode. The two most common modes are `development` and `production`, and each applies different default optimizations. Always provide types and defaults to all of the documentation options in order to keep the documentation accessible and well-written. We are adding types and defaults after entitling the documented option: From a1df78985342a1305440f605f33678d8a670274a Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Fri, 20 Mar 2026 18:01:38 +0530 Subject: [PATCH 2/8] docs: improve explanation of configuration defaults for dev and prod modes --- src/content/contribute/writers-guide.mdx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/content/contribute/writers-guide.mdx b/src/content/contribute/writers-guide.mdx index 78abcc0f811a..14533a448327 100644 --- a/src/content/contribute/writers-guide.mdx +++ b/src/content/contribute/writers-guide.mdx @@ -154,8 +154,31 @@ Please do not assume things are simple. Avoid words like 'just', 'simply'. ``` ### Configuration defaults and types + + Webpack configuration defaults can vary depending on the selected mode. The two most common modes are `development` and `production`, and each applies different default optimizations. +#### Development mode defaults + +- Optimized for debugging +- Includes useful warnings and error messages +- Output is more readable and not minified +- Faster incremental builds + +#### Production mode defaults + +- Optimized for performance +- Output is minified and optimized +- Removes unnecessary code (e.g., dead code elimination) +- Smaller bundle size + +#### Example + +```js +module.exports = { + mode: "development", +}; + Always provide types and defaults to all of the documentation options in order to keep the documentation accessible and well-written. We are adding types and defaults after entitling the documented option: **configuration.example.option** From 1eca543052dea4ed0820992668450585700b8210 Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Sat, 21 Mar 2026 18:12:51 +0530 Subject: [PATCH 3/8] Update src/content/contribute/writers-guide.mdx Co-authored-by: Even Stensberg --- src/content/contribute/writers-guide.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/contribute/writers-guide.mdx b/src/content/contribute/writers-guide.mdx index 14533a448327..75460b3faf8d 100644 --- a/src/content/contribute/writers-guide.mdx +++ b/src/content/contribute/writers-guide.mdx @@ -156,7 +156,7 @@ Please do not assume things are simple. Avoid words like 'just', 'simply'. ### Configuration defaults and types -Webpack configuration defaults can vary depending on the selected mode. The two most common modes are `development` and `production`, and each applies different default optimizations. +Webpack configuration defaults can vary depending on the selected mode. The two used are `development` and `production`, and each applies different default optimizations. #### Development mode defaults From f9221ccd4a53d23802cf5a7d51337e7853b61f86 Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Sat, 21 Mar 2026 18:13:14 +0530 Subject: [PATCH 4/8] Update src/content/contribute/writers-guide.mdx Co-authored-by: Even Stensberg --- src/content/contribute/writers-guide.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/contribute/writers-guide.mdx b/src/content/contribute/writers-guide.mdx index 75460b3faf8d..8d09779df5e3 100644 --- a/src/content/contribute/writers-guide.mdx +++ b/src/content/contribute/writers-guide.mdx @@ -169,7 +169,7 @@ Webpack configuration defaults can vary depending on the selected mode. The two - Optimized for performance - Output is minified and optimized -- Removes unnecessary code (e.g., dead code elimination) +- Removes unnecessary code (e.g. dead code elimination) - Smaller bundle size #### Example From 46e2c5445d0ad35c9a0969237f2ce49bf7cc49b3 Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Sat, 21 Mar 2026 18:13:23 +0530 Subject: [PATCH 5/8] Update src/content/contribute/writers-guide.mdx Co-authored-by: Even Stensberg --- src/content/contribute/writers-guide.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/contribute/writers-guide.mdx b/src/content/contribute/writers-guide.mdx index 8d09779df5e3..572176c86d0d 100644 --- a/src/content/contribute/writers-guide.mdx +++ b/src/content/contribute/writers-guide.mdx @@ -162,7 +162,7 @@ Webpack configuration defaults can vary depending on the selected mode. The two - Optimized for debugging - Includes useful warnings and error messages -- Output is more readable and not minified +- Output is readable and not minified - Faster incremental builds #### Production mode defaults From 504fcb9925a8bb0ac681f2fd911f22950e3a9fff Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Sat, 21 Mar 2026 17:58:32 +0530 Subject: [PATCH 6/8] docs: apply reviewer suggestions for configuration defaults section --- src/content/configuration/output.mdx | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/content/configuration/output.mdx b/src/content/configuration/output.mdx index 738267c451a4..4e69e51f0e14 100644 --- a/src/content/configuration/output.mdx +++ b/src/content/configuration/output.mdx @@ -1586,11 +1586,13 @@ T> Read the [authoring libraries guide](/guides/author-libraries/) guide for mor ### output.library.export -Specify which export should be exposed as a library. +Specify which part of your module should be exposed as the library when it is consumed by other applications. + +By default, the entire module (namespace object) is exposed. However, in many cases, you may want to expose only a specific export, such as the default export or a particular function. - Type: `string | string[]` -It is `undefined` by default, which will export the whole (namespace) object. The examples below demonstrate the effect of this configuration when using [`output.library.type: 'var'`](#type-var). +#### Example: exporting the default export ```js export default { @@ -1602,18 +1604,13 @@ export default { }, }, }; -``` - -The default export of your entry point will be assigned to the library name: +In this case, the default export of your entry module is assigned to the library name: -```js -// if your entry has a default export const MyLibrary = _entry_return_.default; -``` +Example: exporting a nested property -You can pass an array to `output.library.export` as well, it will be interpreted as a path to a module to be assigned to the library name: +You can also pass an array to define a path to a specific export: -```js export default { output: { library: { @@ -1623,14 +1620,7 @@ export default { }, }, }; -``` - -And here's the library code: - -```js const MyLibrary = _entry_return_.default.subModule; -``` - ### output.library.auxiliaryComment Add a comment in the UMD wrapper. From 4ac4d7c2f3c6874c3831cecbb32498c7feea95a1 Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Sat, 21 Mar 2026 19:26:31 +0530 Subject: [PATCH 7/8] fix: add language to code block --- src/content/configuration/output.mdx | 15 +++++++++++++-- src/content/contribute/writers-guide.mdx | 8 ++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/content/configuration/output.mdx b/src/content/configuration/output.mdx index 4e69e51f0e14..dd741ae2b497 100644 --- a/src/content/configuration/output.mdx +++ b/src/content/configuration/output.mdx @@ -1604,13 +1604,19 @@ export default { }, }, }; -In this case, the default export of your entry module is assigned to the library name: +``` + +In this case, the entry module's `default export` is assigned to the library name. +```js const MyLibrary = _entry_return_.default; -Example: exporting a nested property +``` + +### Example: exporting a nested property You can also pass an array to define a path to a specific export: +```js export default { output: { library: { @@ -1620,7 +1626,12 @@ export default { }, }, }; +``` + +```js const MyLibrary = _entry_return_.default.subModule; +``` + ### output.library.auxiliaryComment Add a comment in the UMD wrapper. diff --git a/src/content/contribute/writers-guide.mdx b/src/content/contribute/writers-guide.mdx index 572176c86d0d..8f4842a62ba9 100644 --- a/src/content/contribute/writers-guide.mdx +++ b/src/content/contribute/writers-guide.mdx @@ -155,7 +155,6 @@ Please do not assume things are simple. Avoid words like 'just', 'simply'. ### Configuration defaults and types - Webpack configuration defaults can vary depending on the selected mode. The two used are `development` and `production`, and each applies different default optimizations. #### Development mode defaults @@ -178,8 +177,9 @@ Webpack configuration defaults can vary depending on the selected mode. The two module.exports = { mode: "development", }; +``` -Always provide types and defaults to all of the documentation options in order to keep the documentation accessible and well-written. We are adding types and defaults after entitling the documented option: +Always provide types and defaults for all documented options to keep the documentation clear and accessible. Types and defaults should be added after introducing the option. **configuration.example.option** @@ -247,3 +247,7 @@ An example can be found on the [`options` section of the EvalSourceMapDevToolPlu ### Adding links Please use relative URLs (such as `/concepts/mode/`) to link our own content instead of absolute URLs (such as `https://webpack.js.org/concepts/mode/`). + +```js + +``` From 7cffde08b162cabe6137637e07a03440f5504af9 Mon Sep 17 00:00:00 2001 From: prithvisingh01-tech Date: Wed, 25 Mar 2026 21:08:06 +0530 Subject: [PATCH 8/8] Resolve merge conflict and improve clarity --- src/content/configuration/output.mdx | 19 ++++++++++++----- src/content/contribute/writers-guide.mdx | 26 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/content/configuration/output.mdx b/src/content/configuration/output.mdx index dd741ae2b497..89f90296f08c 100644 --- a/src/content/configuration/output.mdx +++ b/src/content/configuration/output.mdx @@ -1586,12 +1586,17 @@ T> Read the [authoring libraries guide](/guides/author-libraries/) guide for mor ### output.library.export -Specify which part of your module should be exposed as the library when it is consumed by other applications. +Specify which export should be exposed as a library.In other words, this option lets you control which part of your module is exposed when used by other applications. By default, the entire module (namespace object) is exposed. However, in many cases, you may want to expose only a specific export, such as the default export or a particular function. - Type: `string | string[]` +It is `undefined` by default, which will export the whole (namespace) object. + +### Explanation +By default, webpack exposes the entire module, but you can configure it to export only a specific part. + #### Example: exporting the default export ```js @@ -1606,15 +1611,17 @@ export default { }; ``` -In this case, the entry module's `default export` is assigned to the library name. +The default export of your entry point will be assigned to the library name: ```js +// if your entry has a default export const MyLibrary = _entry_return_.default; ``` -### Example: exporting a nested property +You can pass an array to `output.library.export` as well... -You can also pass an array to define a path to a specific export: +### Simplified Explanation +This allows you to access nested properties inside your module. ```js export default { @@ -1628,6 +1635,8 @@ export default { }; ``` +And here's the library code: + ```js const MyLibrary = _entry_return_.default.subModule; ``` @@ -1766,7 +1775,7 @@ MySubModule.doSomething(); W> Please use [`output.library.type`](#outputlibrarytype) instead as we might drop support for `output.libraryTarget` in the future. -Configure how the library will be exposed. Any one of the following options can be used. Please note that this option works in conjunction with the value assigned to [`output.library`](#outputlibrary). For the following examples, it is assumed that the value of [`output.library`](#outputlibrary) is configured as `MyLibrary`. +Configure how the library is exposed and accessed by consumers in different environments (such as browser, Node.js, or module systems). This option defines the format of the generated bundle and how it will be consumed by other applications.Any one of the following options can be used. Please note that this option works in conjunction with the value assigned to [`output.library`](#outputlibrary). For the following examples, it is assumed that the value of [`output.library`](#outputlibrary) is configured as `MyLibrary`. T> Note that `_entry_return_` in the example code below is the value returned by the entry point. In the bundle itself, it is the output of the function that is generated by webpack from the entry point. diff --git a/src/content/contribute/writers-guide.mdx b/src/content/contribute/writers-guide.mdx index 8f4842a62ba9..7e9660075686 100644 --- a/src/content/contribute/writers-guide.mdx +++ b/src/content/contribute/writers-guide.mdx @@ -181,6 +181,32 @@ module.exports = { Always provide types and defaults for all documented options to keep the documentation clear and accessible. Types and defaults should be added after introducing the option. +Webpack configuration defaults can vary depending on the selected mode. The two used are `development` and `production`, and each applies different default optimizations. + +#### Development mode defaults + +- Optimized for debugging +- Includes useful warnings and error messages +- Output is readable and not minified +- Faster incremental builds + +#### Production mode defaults + +- Optimized for performance +- Output is minified and optimized +- Removes unnecessary code (e.g. dead code elimination) +- Smaller bundle size + +#### Example + +```js +module.exports = { + mode: "development", +}; +``` + +Always provide types and defaults for all documented options to keep the documentation clear and accessible. Types and defaults should be added after introducing the option. + **configuration.example.option** `string = 'none'`