Skip to content

Commit 8ee730e

Browse files
authored
docs: add 'modern-module' value for output.library.type (#7370)
1 parent 04c18fd commit 8ee730e

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/content/configuration/output.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ Configure how the library will be exposed.
10251025

10261026
- Type: `string`
10271027

1028-
Types included by default are `'var'`, `'module'`, `'assign'`, `'assign-properties'`, `'this'`, `'window'`, `'self'`, `'global'`, `'commonjs'`, `'commonjs2'`, `'commonjs-module'`, `'commonjs-static'`, `'amd'`, `'amd-require'`, `'umd'`, `'umd2'`, `'jsonp'` and `'system'`, but others might be added by plugins.
1028+
Types included by default are `'var'`, `'module'`, `'modern-module'`, `'assign'`, `'assign-properties'`, `'this'`, `'window'`, `'self'`, `'global'`, `'commonjs'`, `'commonjs2'`, `'commonjs-module'`, `'commonjs-static'`, `'amd'`, `'amd-require'`, `'umd'`, `'umd2'`, `'jsonp'` and `'system'`, but others might be added by plugins.
10291029

10301030
For the following examples, we'll use `_entry_return_` to indicate the values returned by the entry point.
10311031

@@ -1233,6 +1233,29 @@ Output ES Module.
12331233

12341234
However this feature is still experimental and not fully supported yet, so make sure to enable [experiments.outputModule](/configuration/experiments/) beforehand. In addition, you can track the development progress in [this thread](https://github.com/webpack/webpack/issues/2933#issuecomment-774253975).
12351235

1236+
##### type: 'modern-module'
1237+
1238+
<Badge text="v5.93.0+" />
1239+
1240+
```js
1241+
module.exports = {
1242+
//
1243+
experiments: {
1244+
outputModule: true,
1245+
},
1246+
output: {
1247+
library: {
1248+
// do not specify a `name` here
1249+
type: 'modern-module',
1250+
},
1251+
},
1252+
};
1253+
```
1254+
1255+
This configuration generates tree-shakable output for ES Modules.
1256+
1257+
However this feature is still experimental and not fully supported yet, so make sure to enable [experiments.outputModule](/configuration/experiments/) beforehand.
1258+
12361259
##### type: 'commonjs2'
12371260

12381261
```js

0 commit comments

Comments
 (0)