Skip to content

Commit 03464f8

Browse files
metatoasterskipjack
authored andcommitted
docs(config): elaborate on array usage in externals (#1348)
To make it easier to discover use case reported by webpack/webpack#4665 from the documentation, as the existing array example only convey/imply that only modules are supported by this construct.
1 parent cf6460b commit 03464f8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

content/configuration/externals.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,17 @@ externals : {
8888
root: "_" // indicates global variable
8989
}
9090
}
91+
92+
// or
93+
94+
externals : {
95+
subtract : {
96+
root: ["math", "subtract"]
97+
}
98+
}
9199
```
92100

93-
This syntax is used to describe all the possible ways that an external library can be available. `lodash` here is available as `lodash` under AMD and CommonJS module systems but available as `_` in a global variable form.
101+
This syntax is used to describe all the possible ways that an external library can be available. `lodash` here is available as `lodash` under AMD and CommonJS module systems but available as `_` in a global variable form. `subtract` here is available via the property `subtract` under the global `math` object (e.g. `window['math']['subtract']`).
94102

95103

96104
### function

0 commit comments

Comments
 (0)