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/rsbuild-plugin/interfaces/LynxConfig.md.
Lynx
  • 简体中文
  • 接口: LynxConfig

    Beta

    pluginLynx 暴露给其他插件的 Lynx 配置。

    备注

    该数据与 LynxPluginOptions 保持一致,因此插件读取 config.output.filename 的方式与从 api.getRsbuildConfig() 读取 output.filename 相同。依赖于当前构建入口的值由方法推导得出,这些方法随数据一起传递,从而确保始终由构建该配置的插件来解析这些值。

    示例

    const lynx = getLynxConfig(api)
    const filename = lynx.resolveBundleFilename({
      entryName: 'main',
      platform: environment.name,
    })

    属性

    output

    readonly output: LynxOutput

    Beta

    构建产物。


    performance

    readonly performance: LynxPerformance

    Beta

    性能选项。

    方法

    resolveBundleFilename()

    resolveBundleFilename(context: object): string

    Beta

    解析入口的 bundle 文件名。

    参数

    参数类型描述
    context{ entryName: string; platform: string; }要解析文件名的入口。
    context.entryNamestring-
    context.platformstring-

    返回

    string


    resolveIntermediateDir()

    resolveIntermediateDir(context?: object): string

    Beta

    解析中间产物所在的目录。

    参数

    参数类型描述
    context?{ entryName?: string; }要解析目录的入口。不传入口名时,返回存放所有入口目录的那个目录。
    context.entryName?string-

    返回

    string

    备注

    Lynx bundle 由各线程的 JS、CSS 和 HMR 产物编码而成。这些产物按入口输出到该目录中,而不是与 bundle 放在一起。


    resolveLazyBundleFilename()

    resolveLazyBundleFilename(context: object): string | undefined

    Beta

    解析 lazy bundle 文件的名称。

    参数

    参数类型描述
    context{ platform: string; }要解析文件名的 environment。
    context.platformstring-

    返回

    string | undefined

    解析得到的名称;当 LynxFilename.bundle 不是函数时为 undefined。lazy bundle 的名称是按异步 chunk 解析的,只能通过函数自定义,因此 undefined 表示调用方把命名交给 LynxTemplatePlugin。

    备注

    此时没有可用于解析 [name] 的入口名称,因此保留该占位符,由 LynxTemplatePlugin 按异步 chunk 填充。

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。