You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/configuration/output.mdx
+7-17Lines changed: 7 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1586,11 +1586,13 @@ T> Read the [authoring libraries guide](/guides/author-libraries/) guide for mor
1586
1586
1587
1587
### output.library.export
1588
1588
1589
-
Specify which export should be exposed as a library.
1589
+
Specify which part of your module should be exposed as the library when it is consumed by other applications.
1590
+
1591
+
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.
1590
1592
1591
1593
- Type: `string | string[]`
1592
1594
1593
-
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).
1595
+
#### Example: exporting the defaultexport
1594
1596
1595
1597
```js
1596
1598
exportdefault {
@@ -1602,18 +1604,13 @@ export default {
1602
1604
},
1603
1605
},
1604
1606
};
1605
-
```
1606
-
1607
-
The default export of your entry point will be assigned to the library name:
1607
+
In this case, the default exportofyourentrymoduleisassignedtothelibraryname:
1608
1608
1609
-
```js
1610
-
// if your entry has a default export
1611
1609
constMyLibrary=_entry_return_.default;
1612
-
```
1610
+
Example: exporting a nested property
1613
1611
1614
-
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:
1612
+
You can also pass an array to define a path to a specific export:
0 commit comments