From 41e873ed01e47179a37ca12095861a0443cdf66b Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 29 Jul 2024 21:46:40 +0800 Subject: [PATCH] docs: simplify `tools.rspack` examples (#3061) --- website/docs/en/config/dev/watch-files.mdx | 7 ++++--- website/docs/en/guide/advanced/module-federation.mdx | 6 +++--- website/docs/zh/config/dev/watch-files.mdx | 7 ++++--- website/docs/zh/guide/advanced/module-federation.mdx | 6 +++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/website/docs/en/config/dev/watch-files.mdx b/website/docs/en/config/dev/watch-files.mdx index 5f4f176b9f..78758dbda0 100644 --- a/website/docs/en/config/dev/watch-files.mdx +++ b/website/docs/en/config/dev/watch-files.mdx @@ -29,9 +29,10 @@ For instance, if you want to prevent a rebuild when files in the `node_modules` ```js export default { tools: { - rspack: (config) => { - config.watchOptions ??= {}; - config.watchOptions.ignored = /node_modules/; + rspack: { + watchOptions: { + ignored: /node_modules/, + }, }, }, }; diff --git a/website/docs/en/guide/advanced/module-federation.mdx b/website/docs/en/guide/advanced/module-federation.mdx index d88bb53fbb..c4a236e2ac 100644 --- a/website/docs/en/guide/advanced/module-federation.mdx +++ b/website/docs/en/guide/advanced/module-federation.mdx @@ -51,13 +51,13 @@ import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack'; export default defineConfig({ tools: { - rspack: (config, { appendPlugins }) => { - appendPlugins([ + rspack: { + plugins: [ new ModuleFederationPlugin({ name: 'provider', // other options }), - ]); + ], }, }, }); diff --git a/website/docs/zh/config/dev/watch-files.mdx b/website/docs/zh/config/dev/watch-files.mdx index 83e8fd69ed..564a512615 100644 --- a/website/docs/zh/config/dev/watch-files.mdx +++ b/website/docs/zh/config/dev/watch-files.mdx @@ -29,9 +29,10 @@ Rsbuild (Rspack) 默认会监听所有构建依赖,当这些文件发生变化 ```js export default { tools: { - rspack: (config) => { - config.watchOptions ??= {}; - config.watchOptions.ignored = /node_modules/; + rspack: { + watchOptions: { + ignored: /node_modules/, + }, }, }, }; diff --git a/website/docs/zh/guide/advanced/module-federation.mdx b/website/docs/zh/guide/advanced/module-federation.mdx index 26adbba674..fa40ea5096 100644 --- a/website/docs/zh/guide/advanced/module-federation.mdx +++ b/website/docs/zh/guide/advanced/module-federation.mdx @@ -51,13 +51,13 @@ import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack'; export default defineConfig({ tools: { - rspack: (config, { appendPlugins }) => { - appendPlugins([ + rspack: { + plugins: [ new ModuleFederationPlugin({ name: 'provider', // other options }), - ]); + ], }, }, });