Home > @lynx-js/externals-loading-webpack-plugin > ExternalValue
Signature:
| Property | Modifiers | Type | Description |
|---|---|---|---|
| async? | boolean | (Optional) Whether the source should be loaded asynchronously or not. | |
| background? | LayerOptions | (Optional) The options of the background layer. | |
| libraryName? | string | string[] | (Optional) The name of the library. Same as https://webpack.js.org/configuration/externals/\#string. By default, the library name is the same as the externals key. For example: The config |
Will generate the following webpack externals config:
```js externals: { lodash: 'lynx[Symbol.for("__LYNX_EXTERNAL_GLOBAL__")].lodash', } ```If one external bundle contains multiple modules, should set the same library name to ensure it's loaded only once. For example:
```js ExternalsLoadingPlugin({ externals: { lodash: { libraryName: 'Lodash', url: '……', }, 'lodash-es': { libraryName: 'Lodash', url: '……', } } }) ```Will generate the following webpack externals config:
```js externals: { lodash: 'lynx[Symbol.for("__LYNX_EXTERNAL_GLOBAL__")].Lodash', 'lodash-es': 'lynx[Symbol.for("__LYNX_EXTERNAL_GLOBAL__")].Lodash', } ```You can pass an array to specify subpath of the external. Same as https://webpack.js.org/configuration/externals/\#string-1. For example:
```js ExternalsLoadingPlugin({ externals: { preact: { libraryName: ['ReactLynx', 'Preact'], url: '……', }, } }) ```Will generate the following webpack externals config:
```js externals: { preact: 'lynx[Symbol.for("__LYNX_EXTERNAL_GLOBAL__")].ReactLynx.Preact', } ``` | | [mainThread?](./externals-loading-webpack-plugin.externalvalue.mainthread.md) | | [LayerOptions](./externals-loading-webpack-plugin.layeroptions.md) | _(Optional)_ The options of the main-thread layer. | | [timeout?](./externals-loading-webpack-plugin.externalvalue.timeout.md) | | number | _(Optional)_ The wait time in milliseconds. | | [url](./externals-loading-webpack-plugin.externalvalue.url.md) | | string | The bundle(lynx.bundle) url of the library. The library source should be placed incustomSections. |