docs: add conflict guidelines for tools.swc#6887
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR adds documentation for handling configuration conflicts between jsc.target and env in SWC configuration. The documentation describes how Rsbuild manages these conflicts to prevent errors when users manually configure jsc.target.
Key changes:
- Added a new "Configuration conflicts" section explaining SWC's
jsc.targetandenvincompatibility - Documents Rsbuild's conflict handling strategies for both user-set
jsc.targetandoutput.polyfillscenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| website/docs/en/config/tools/swc.mdx | Added English documentation section for handling SWC configuration conflicts |
| website/docs/zh/config/tools/swc.mdx | Added Chinese documentation section for handling SWC configuration conflicts |
Critical Issue Identified: The documentation describes behavior (automatically removing env.targets when jsc.target is set) that does not appear to be implemented in the current codebase. The implementation uses simple deepmerge without conflict detection logic. This represents a significant discrepancy between the documented and actual behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| 为了避免冲突,Rsbuild 采取以下处理策略: | ||
|
|
||
| - 当 Rsbuild 检测到你在 `tools.swc` 中手动设置了 `jsc.target` 时,会自动移除内置的 `env.targets`。 |
There was a problem hiding this comment.
此文档声称"Rsbuild 会自动移除内置的 env.targets"当手动设置 jsc.target 时。然而,检查 packages/core/src/plugins/swc.ts (第182-186行) 的实现,配置合并是使用 reduceConfigs 和 deepmerge 执行的,并没有检查 jsc.target 是否存在并移除 env.targets 的逻辑。
相关的 PR #6886 描述中提到添加检查以在检测到 jsc.target 时自动取消设置 env.targets,但此逻辑在当前实现中似乎不存在。要么需要更新实现以匹配此文档,要么应修改文档以准确反映当前行为。
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Summary
Added a new section to the documentation describing how Rsbuild manages conflicts between
jsc.targetandenv.Related Links
env.targetswhenjsc.targetis set #6886Checklist