Skip to content

Commit 9033607

Browse files
EugeneHlushkomontogeek
authored andcommitted
docs(config) Externals as object note about umd library target (#2669)
1 parent ed262d7 commit 9033607

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/content/configuration/externals.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ __index.html__
3535

3636
__webpack.config.js__
3737

38-
```js
38+
```javascript
3939
module.exports = {
4040
//...
4141
externals: {
@@ -46,7 +46,7 @@ module.exports = {
4646

4747
This leaves any dependent modules unchanged, i.e. the code shown below will still work:
4848

49-
```js
49+
```javascript
5050
import $ from 'jquery';
5151

5252
$('.my-element').animate(/* ... */);
@@ -69,7 +69,7 @@ See the example above. The property name `jquery` indicates that the module `jqu
6969

7070
### array
7171

72-
```js
72+
```javascript
7373
module.exports = {
7474
//...
7575
externals: {
@@ -83,7 +83,9 @@ module.exports = {
8383

8484
### object
8585

86-
```js
86+
W> An object with `{ root, amd, commonjs, ... }` is only allowed for [`libraryTarget: 'umd'`](/configuration/output/#output-librarytarget). It's not allowed for other library targets.
87+
88+
```javascript
8789
module.exports = {
8890
//...
8991
externals : {
@@ -119,7 +121,7 @@ It might be useful to define your own function to control the behavior of what y
119121

120122
It basically comes down to this:
121123

122-
```js
124+
```javascript
123125
module.exports = {
124126
//...
125127
externals: [
@@ -140,7 +142,7 @@ The `'commonjs ' + request` defines the type of module that needs to be external
140142

141143
Every dependency that matches the given regular expression will be excluded from the output bundles.
142144

143-
```js
145+
```javascript
144146
module.exports = {
145147
//...
146148
externals: /^(jquery|\$)$/i
@@ -153,7 +155,7 @@ In this case any dependency named `jQuery`, capitalized or not, or `$` would be
153155

154156
Sometimes you may want to use a combination of the above syntaxes. This can be done in the following manner:
155157

156-
```js
158+
```javascript
157159
module.exports = {
158160
//...
159161
externals: [

0 commit comments

Comments
 (0)