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',
  },
})
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.