Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: how to ignore specific warnings #4605

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/builder/builder-shared/src/types/bundlerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export interface BundlerChain
| 'get'
| 'experiments'
| 'profile'
| 'ignoreWarnings'
> {
toConfig: () => BundlerConfig;
optimization: PickAndModifyThis<
Expand Down
20 changes: 20 additions & 0 deletions packages/document/builder-doc/docs/en/guide/faq/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,23 @@ Inspect config succeed, open following files to view the content:
- Builder Config: /root/my-project/dist/builder.config.js
- Rspack Config (web): /root/my-project/dist/rspack.config.web.js
```

---

### How to ignore specific warnings?

By default, Builder will print all error and warning logs generated by the build process.

If a large number of warning logs are generated due to the three-party package, it cannot be processed temporarily, and you want to ignore it. Specific warning logs can be ignored through the build configuration provided by webpack / Rspack.

```ts
export default {
tools: {
bundlerChain: chain => {
chain.ignoreWarnings([/Using \/ for division outside of calc()/]);
},
},
};
```

For details, please refer to: [ignoreWarnings](https://webpack.js.org/configuration/other-options/#ignorewarnings).
20 changes: 20 additions & 0 deletions packages/document/builder-doc/docs/zh/guide/faq/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,23 @@ Inspect config succeed, open following files to view the content:
- Builder Config: /root/my-project/dist/builder.config.js
- Rspack Config (web): /root/my-project/dist/rspack.config.web.js
```

---

### 如何忽略特定 warning 日志?

默认情况下,Builder 会打印构建过程产生的所有 error 和 warning 日志。

如果遇到由于三方包产生大量 warning 日志,暂时又无法处理,希望忽略的情况。可通过 webpack / Rspack 提供的构建配置忽略特定 warning 日志。

```ts
export default {
tools: {
bundlerChain: chain => {
chain.ignoreWarnings([/Using \/ for division outside of calc()/]);
},
},
};
```

详细信息可参考: [ignoreWarnings](https://webpack.js.org/configuration/other-options/#ignorewarnings)。