Home > @lynx-js/lynx-bundle-rslib-config > defineExternalBundleRslibConfig
Get the rslib config for building Lynx external bundles.
Signature:
| Parameter | Type | Description |
|---|---|---|
| userLibConfig | ExternalBundleLibConfig | |
| encodeOptions | EncodeOptions | (Optional) |
Returns:
RslibConfig
If you want to build an external bundle which use in Lynx background thread, you can use the following code:
Then you can use lynx.loadScript('utils', { bundleName: 'utils-lib-bundle-url' }) in background thread.
If you want to build an external bundle which use in Lynx main thread, you can use the following code:
Then you can use lynx.loadScript('utils', { bundleName: 'utils-lib-bundle-url' }) in main-thread.
If you want to build an external bundle which use both in Lynx main thread and background thread. You don't need to set the layer.
Then you can use lynx.loadScript('utils', { bundleName: 'utils-lib-bundle-url' }) in background thread and lynx.loadScript('utils__main-thread', { bundleName: 'utils-lib-bundle-url' }) in main-thread.