Home > @lynx-js/lynx-bundle-rslib-config > defineExternalBundleRslibConfig

defineExternalBundleRslibConfig() function

Get the Rslib config for building Lynx external bundles.

Signature:

export declare function defineExternalBundleRslibConfig(userLibConfig: ExternalBundleLibConfig, encodeOptions?: EncodeOptions): RslibConfig;

Parameters

ParameterTypeDescription
userLibConfigExternalBundleLibConfigUser-provided Rslib config.
encodeOptionsEncodeOptionsOptional encode options.

Returns:

RslibConfig

Example

import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'

export default defineExternalBundleRslibConfig({
  id: 'comp-lib',
  source: {
    entry: {
      './App.js': './external-bundle/CompLib.tsx',
    },
  },
  plugins: [pluginReactLynx()],
  output: {
    externalsPresets: {
      reactlynx: true,
    },
    globalObject: 'globalThis',
  },
})
除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。