For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/packages/external-bundle-rsbuild-plugin/functions/pluginExternalBundle.md.
Lynx
  • 简体中文
  • 函数: pluginExternalBundle()

    pluginExternalBundle(options: PluginExternalBundleOptions): RsbuildPlugin

    创建一个用于加载 external bundle 的 Rsbuild 插件。

    该插件封装了 externals-loading-webpack-plugin,并通过 api.useExposed 自动从 react-rsbuild-plugin 获取 layer 名称。

    参数

    参数类型
    optionsPluginExternalBundleOptions

    返回

    RsbuildPlugin

    示例

    // rsbuild.config.ts
    import { pluginExternalBundle } from '@lynx-js/external-bundle-rsbuild-plugin'
    import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
    
    export default {
      plugins: [
        pluginReactLynx(),
        pluginExternalBundle({
          externals: {
            lodash: {
              bundlePath: 'lodash.lynx.bundle',
              background: { sectionPath: 'background' },
              mainThread: { sectionPath: 'mainThread' },
            },
          },
        }),
      ],
    }
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。