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

    createRspeedy 方法的选项。

    属性

    callerName?

    optional callerName?: string

    当前调用 Rsbuild 的框架或工具的名称。插件可以据此根据调用上下文调整自身行为。

    示例

    Rsbuild 插件可以通过 api.context.callerName 访问该值。

    export function myPlugin() {
      return {
        name: 'my-plugin',
        setup(api) {
          // Log the name of the tool invoking Rsbuild
          console.log(`Called by: ${api.context.callerName}`);
    
          // Conditionally apply plugin logic based on caller
          if (api.context.callerName === 'rspeedy') {
            api.modifyRsbuildConfig((config) => {
              // Apply rspeedy-specific config changes
              return config;
            });
          } else if (api.context.callerName === 'rslib') {
            api.modifyRsbuildConfig((config) => {
              // Apply rslib-specific config changes
              return config;
            });
          }
        }
      };
    }

    默认值

    'rspeedy'

    cwd?

    optional cwd?: string

    当前构建的根路径。


    environment?

    optional environment?: string[]

    仅构建指定的 environment。例如,传入 ['lynx'] 将只构建 lynx environment。如果未指定或传入空数组,则会构建所有 environment。

    参阅

    https://rsbuild.rs/guide/advanced/environments#build-specified-environment

    默认值

    []

    loadEnv?

    optional loadEnv?: boolean | LoadEnvOptions

    Rspeedy 默认会通过 Rsbuild API 自动加载 .env 文件。你可以在代码中通过 import.meta.env.FOO 或 process.env.Foo 访问 .env 文件中定义的环境变量。

    参阅

    https://rsbuild.rs/guide/advanced/env-vars#env-file

    默认值

    true

    rspeedyConfig?

    optional rspeedyConfig?: Config

    Rspeedy 的配置。

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