From 56168ad8319b84b109c3f53f82300f055d3ccb82 Mon Sep 17 00:00:00 2001
From: Timeless0911 <1604889533@qq.com>
Date: Wed, 21 May 2025 14:38:09 +0800
Subject: [PATCH 1/4] docs: optimize `source.exclude` description
---
website/docs/en/config/rsbuild/source.mdx | 13 ++++++++++++-
website/docs/zh/config/rsbuild/source.mdx | 13 ++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/website/docs/en/config/rsbuild/source.mdx b/website/docs/en/config/rsbuild/source.mdx
index d5ee21ca7..520539b59 100644
--- a/website/docs/en/config/rsbuild/source.mdx
+++ b/website/docs/en/config/rsbuild/source.mdx
@@ -48,7 +48,18 @@ Check out the [lib.bundle](/config/lib/bundle#set-entry) to learn more about how
## source.exclude
-Specifies JavaScript/TypeScript files that do not need to be compiled.
+Exclude JavaScript or TypeScript files that do not need to be compiled by [SWC](https://rsbuild.dev/guide/configuration/swc).
+
+::: note
+
+Files configured in `source.exclude` will not be translated by SWC, but the referenced files will still be bundled into the outputs.
+
+If you want certain files not to be bundled into the outputs, you can use the following methods:
+
+- **bundle mode**: Use Rspack's [IgnorePlugin](https://rspack.dev/plugins/webpack/ignore-plugin).
+- **bundleless mode**: Use `source.entry` to configure the corresponding glob expression, refer to [Set entry](/config/lib/bundle#bundle-false).
+
+:::
## source.include
diff --git a/website/docs/zh/config/rsbuild/source.mdx b/website/docs/zh/config/rsbuild/source.mdx
index 068af35ee..b2d8ce453 100644
--- a/website/docs/zh/config/rsbuild/source.mdx
+++ b/website/docs/zh/config/rsbuild/source.mdx
@@ -47,7 +47,18 @@ const defaultEntry = {
## source.exclude
-指定不需要编译的 JavaScript/TypeScript 文件。
+排除不需要被 [SWC](https://rsbuild.dev/zh/guide/configuration/swc) 编译的 JavaScript 或 TypeScript 文件。
+
+::: note
+
+在 `source.exclude` 中配置的文件不会经过 SWC 转译,但被引用的文件仍然会被打包到产物中。
+
+如果你希望某些文件不被打包到产物中,可以使用以下方法:
+
+- **bundle 模式**:使用 Rspack 的 [IgnorePlugin](https://rspack.dev/zh/plugins/webpack/ignore-plugin)。
+- **bundleless 模式**:使用 `source.entry` 配置相应的 glob 表达式,参考 [设置入口](/config/lib/bundle#bundle-false)。
+
+:::
## source.include
From b8b6cf08b2c53577e46fbae54a21a02d95054457 Mon Sep 17 00:00:00 2001
From: Timeless0911 <50201324+Timeless0911@users.noreply.github.com>
Date: Wed, 21 May 2025 14:50:22 +0800
Subject: [PATCH 2/4] Update website/docs/en/config/rsbuild/source.mdx
Co-authored-by: Wei
---
website/docs/en/config/rsbuild/source.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/docs/en/config/rsbuild/source.mdx b/website/docs/en/config/rsbuild/source.mdx
index 520539b59..81da7ac20 100644
--- a/website/docs/en/config/rsbuild/source.mdx
+++ b/website/docs/en/config/rsbuild/source.mdx
@@ -48,7 +48,7 @@ Check out the [lib.bundle](/config/lib/bundle#set-entry) to learn more about how
## source.exclude
-Exclude JavaScript or TypeScript files that do not need to be compiled by [SWC](https://rsbuild.dev/guide/configuration/swc).
+Exclude JavaScript or TypeScript files that do not need to be transformed by [SWC](https://rsbuild.dev/guide/configuration/swc).
::: note
From 9633e924e3e2b9da450e8c66a59e3f1f39b88891 Mon Sep 17 00:00:00 2001
From: Timeless0911 <50201324+Timeless0911@users.noreply.github.com>
Date: Wed, 21 May 2025 14:50:40 +0800
Subject: [PATCH 3/4] Update website/docs/en/config/rsbuild/source.mdx
Co-authored-by: Wei
---
website/docs/en/config/rsbuild/source.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/docs/en/config/rsbuild/source.mdx b/website/docs/en/config/rsbuild/source.mdx
index 81da7ac20..f6532dfef 100644
--- a/website/docs/en/config/rsbuild/source.mdx
+++ b/website/docs/en/config/rsbuild/source.mdx
@@ -52,7 +52,7 @@ Exclude JavaScript or TypeScript files that do not need to be transformed by [SW
::: note
-Files configured in `source.exclude` will not be translated by SWC, but the referenced files will still be bundled into the outputs.
+Files configured in `source.exclude` will not be transformed by SWC, but the referenced files will still be bundled into the outputs.
If you want certain files not to be bundled into the outputs, you can use the following methods:
From f34529e4b276e243eca31115a49cce8115811c03 Mon Sep 17 00:00:00 2001
From: Timeless0911 <50201324+Timeless0911@users.noreply.github.com>
Date: Wed, 21 May 2025 14:51:23 +0800
Subject: [PATCH 4/4] Update website/docs/zh/config/rsbuild/source.mdx
---
website/docs/zh/config/rsbuild/source.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/docs/zh/config/rsbuild/source.mdx b/website/docs/zh/config/rsbuild/source.mdx
index b2d8ce453..00d1e7e44 100644
--- a/website/docs/zh/config/rsbuild/source.mdx
+++ b/website/docs/zh/config/rsbuild/source.mdx
@@ -47,7 +47,7 @@ const defaultEntry = {
## source.exclude
-排除不需要被 [SWC](https://rsbuild.dev/zh/guide/configuration/swc) 编译的 JavaScript 或 TypeScript 文件。
+排除不需要被 [SWC](https://rsbuild.dev/zh/guide/configuration/swc) 转译的 JavaScript 或 TypeScript 文件。
::: note