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: content/configuration/externals.md
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,16 @@ contributors:
7
7
- pksjce
8
8
---
9
9
10
-
`externals`configuration in webpack provides a way of not including a dependency in the bundle. Instead the created bundle relies on that dependency to be present in the consumers environment.
11
-
This typically applies to library developers though application developers can make good use of this feature too.
T> __consumer__ here is any end user application that includes the library that you have bundled using webpack.
47
+
T> __用户(consumer)__,在这里是指任何用户应用程序终端(end user application),并且包含了使用 webpack 打包的 library。
48
48
49
-
Your bundle which has external dependencies can be used in various module contexts mainly [CommonJS, AMD, global and ES2015 modules](/concepts/modules). The external library may be available in any of the above form but under different variables.
*__global__ - An external library can be available as a global variable. The consumer can achieve this by including the external library in a script tag. This is the default setting for externals.
54
-
*__commonjs__ - The consumer application may be using a CommonJS module system and hence the external library should be available as a CommonJS module.
55
-
*__commonjs2__ - Similar to the above line but where the export is `module.exports.default`.
56
-
*__amd__ - Similar to the above line but using AMD module system.
`subtract: ['./math', 'subtract']`converts to a parent child construct, where `./math`is the parent module and your bundle only requires the subset under `subtract`variable.
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.
0 commit comments