Skip to content

Commit c0cf4d8

Browse files
authored
docs: add rspack tip about source. include & exclude (#3664)
1 parent 3c0c5bb commit c0cf4d8

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

packages/document/builder-doc/docs/en/config/source/exclude.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
Specifies JavaScript/TypeScript files that do not need to be compiled. The usage is consistent with [Rule.exclude](https://webpack.js.org/configuration/module/#ruleexclude) in webpack, which supports passing in strings or regular expressions to match the module path.
66

7+
:::tip
8+
When using Rspack as the bundler, **all files** will be compiled by default, and at the same time, exclusion through `source.exclude` is not supported.
9+
:::
10+
711
For example:
812

913
```js

packages/document/builder-doc/docs/en/config/source/include.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export default {
1818
};
1919
```
2020

21+
:::tip
22+
When using Rspack as the bundler, **all files** will be compiled by default, and at the same time, exclusion through `source.exclude` is not supported.
23+
:::
24+
2125
### Compile Npm Packages
2226

2327
A typical usage scenario is to compile npm packages under node_modules, because some third-party dependencies have ES6+ syntax, which may cause them to fail to run on low-version browsers. You can solve the problem by using this config to specify the dependencies that need to be compiled.

packages/document/builder-doc/docs/zh/config/source/exclude.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
指定不需要编译的 JavaScript/TypeScript 文件。用法与 webpack 中的 [Rule.exclude](https://webpack.js.org/configuration/module/#ruleexclude) 一致,支持传入字符串或正则表达式来匹配模块的路径。
66

7+
8+
:::tip
9+
在使用 Rspack 作为打包工具时,默认**所有文件**都会经过编译,同时,不支持通过 `source.exclude` 排除。
10+
:::
11+
712
比如:
813

914
```js

packages/document/builder-doc/docs/zh/config/source/include.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export default {
1818
};
1919
```
2020

21+
:::tip
22+
在使用 Rspack 作为打包工具时,默认**所有文件**都会经过编译,同时,不支持通过 `source.exclude` 排除。
23+
:::
24+
2125
### 编译 npm 包
2226

2327
比较典型的使用场景是编译 node_modules 下的 npm 包,因为某些第三方依赖存在 ES6+ 的语法,这可能导致在低版本浏览器上无法运行,你可以通过该选项指定需要编译的依赖,从而解决此类问题。

0 commit comments

Comments
 (0)