close
logologo
指南
配置
插件
API
社区
版本
更新日志
Rsbuild 0.x 文档
English
简体中文
指南
配置
插件
API
社区
更新日志
Rsbuild 0.x 文档
English
简体中文
logologo
社区

版本发布

总览
Rsbuild 1.0 发布
Rsbuild 0.7 发布
Rsbuild 0.6 发布
Rsbuild 0.5 发布
Rsbuild 0.4 发布
Rsbuild 0.3 发布
Rsbuild 0.2 发布
Rsbuild 0.1 发布
📝 在 GitHub 上编辑此页
上一页Rsbuild 0.3 发布
下一页Rsbuild 0.1 发布

December 11, 2023

#Rsbuild 0.2 发布

Rsbuild 0.2 版本包含一些 API 的不兼容更新,请参考当前文档进行升级。

#Targets

我们将 createRsbuild 方法的 target 移动至 rsbuild 配置对象中,这个改动使用户可以在 Rsbuild 配置文件中配置 targets。

  • before:
const rsbuild = await createRsbuild({
  target: ['web', 'node'],
});
  • after:
// rsbuild.config.ts
export default {
  output: {
    targets: ['web', 'node'],
  },
};

仅影响 JavaScript API。使用 Rsbuild CLI 的用户不需要做任何改变。

#Entry

删除已弃用的 source.entries 配置。

自 Rsbuild 0.1.0 起,source.entries 已更名为 source.entry,我们在 Rsbuild v0.2.0中删除了source.entries` 配置。

  • before:
// rsbuild.config.ts
export default {
  source: {
    entries: {},
  },
};
  • after:
// rsbuild.config.ts
export default {
  source: {
    entry: {},
  },
};

#Write to disk

dev.writeToDisk 的默认值变更为 false.

原因:

  • 减少文件系统开销,提升开发服务器性能。
  • 避免触发 UnoCSS 和其他工具的监听器。参考:#654。
  • 使默认行为与 webpack-dev-middleware 及其他社区开发服务器保持一致。

用户可以手动开启写入磁盘:

export default {
  dev: {
    writeToDisk: true,
  },
};

#Babel 插件

@rsbuild/plugin-babel 将所有的 babel-loader 选项移动到 babelLoaderOptions:

  • before:
pluginBabel({
  plugins: [],
  presets: [],
});
  • after:
pluginBabel([
  babelLoaderOptions: {
    plugins: [],
    presets: [],
  }
]);

这种改变使我们能为 pluginBabel 添加更多选项,如 include 和 exclude。

#Source map

output.disableSourceMap 已经更名为 output.sourceMap.

  • before:
export default {
  output: {
    disableSourceMap: {
      js: true,
      css: true,
    },
  },
};
  • after:
export default {
  output: {
    sourceMap: {
      js: false,
      css: false,
    },
  },
};

source map 的默认值已更新,以提升构建性能。

  • 之前:在开发阶段生成 JS / CSS 的 source map,在生产阶段生成 JS 的 source map。
  • 之后:在开发阶段生成 JS 的 source map,在生产阶段不生成 source map。

#Inject styles

将 output.disableCssExtract 更名为 output.injectStyles 以更加直观:

  • before:
export default {
  output: {
    disableCssExtract: true,
  },
};
  • after:
export default {
  output: {
    injectStyles: true,
  },
};