diff --git a/src/content/configuration/output.mdx b/src/content/configuration/output.mdx index 6debfd13fbbb..39156c000978 100644 --- a/src/content/configuration/output.mdx +++ b/src/content/configuration/output.mdx @@ -1025,7 +1025,7 @@ Configure how the library will be exposed. - Type: `string` - 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. + 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. For the following examples, we'll use `_entry_return_` to indicate the values returned by the entry point. @@ -1233,6 +1233,29 @@ Output ES Module. 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). +##### type: 'modern-module' + + + +```js +module.exports = { + // … + experiments: { + outputModule: true, + }, + output: { + library: { + // do not specify a `name` here + type: 'modern-module', + }, + }, +}; +``` + +This configuration generates tree-shakable output for ES Modules. + +However this feature is still experimental and not fully supported yet, so make sure to enable [experiments.outputModule](/configuration/experiments/) beforehand. + ##### type: 'commonjs2' ```js