From 8a79ff6f77508f4c6404ab6c9f1c8f2d43885e63 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 29 Aug 2024 11:29:12 +0800 Subject: [PATCH] docs: add Rspack config validation to migration guide (#3309) --- website/docs/en/guide/migration/rsbuild-0-x.mdx | 9 +++++++++ website/docs/zh/guide/migration/rsbuild-0-x.mdx | 12 +++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/website/docs/en/guide/migration/rsbuild-0-x.mdx b/website/docs/en/guide/migration/rsbuild-0-x.mdx index 8c4f5d8a87..36e42ab34b 100644 --- a/website/docs/en/guide/migration/rsbuild-0-x.mdx +++ b/website/docs/en/guide/migration/rsbuild-0-x.mdx @@ -92,6 +92,15 @@ export default { }; ``` +## [Important] Rspack Config Validation + +Rsbuild now enables Rspack's scheme validation by default to ensure the Rspack configuration is correct. + +- If there is a type error in the Rspack config object, an error will be thrown and the build will be aborted. +- If there are extra fields in the Rspack config object, an error will be thrown, but the build will not fail. + +> For more details, see [Rspack - RSPACK_CONFIG_VALIDATE](https://rspack.dev/guide/migration/webpack#updating-configuration). + ## source.alias Removed `target` param for `source.alias` function, use [environments](/config/environments) config instead. diff --git a/website/docs/zh/guide/migration/rsbuild-0-x.mdx b/website/docs/zh/guide/migration/rsbuild-0-x.mdx index ec91094237..cb99586056 100644 --- a/website/docs/zh/guide/migration/rsbuild-0-x.mdx +++ b/website/docs/zh/guide/migration/rsbuild-0-x.mdx @@ -92,6 +92,15 @@ export default { }; ``` +## [重要] Rspack 配置校验 + +Rsbuild 现在默认启用 Rspack 的 scheme 校验,以确保 Rspack 配置的正确性。 + +- 当 Rspack 配置的类型错误时,会抛出错误并终止构建。 +- 当 Rspack 配置中存在多余的字段时,会抛出错误,但不会终止构建。 + +> 详见 [Rspack - RSPACK_CONFIG_VALIDATE](https://rspack.dev/guide/migration/webpack#updating-configuration)。 + ## source.alias 移除 `source.alias` 函数的 `target` 参数,改用 [environments](/config/environments) 配置。 @@ -334,7 +343,8 @@ export default { ```diff export default { - dev: { +- dev: { ++ server: { - startUrl: true, + open: true, }