dev.lazyCompilation

  • 类型:
type LazyCompilationOptions =
  | boolean
  | {
      /**
       * 为 entries 启用 lazy compilation
       */
      entries?: boolean;
      /**
       * 为 dynamic imports 启用 lazy compilation
       */
      imports?: boolean;
      /**
       * 指定哪些导入的模块应该被延迟编译
       */
      test?: RegExp | ((m: Module) => boolean);
      /**
       * 指定一个自定义的运行时代码路径,用于覆盖默认的 lazy compilation client
       */
      client?: string;
      /**
       * 指定 client 需要请求的 server URL
       */
      serverUrl?: string;
    };
  • 默认值: false

用于开启 lazy compilation(即按需编译),基于 Rspack 的 lazy compilation 特性实现。

Info

该配置项的使用方式与 Rsbuild 完全一致,详细信息可参考 Rsbuild - dev.lazyCompilation