Skip to content

docs: add conflict guidelines for tools.swc#6887

Merged
chenjiahan merged 2 commits intomainfrom
swc_doc_0104
Jan 5, 2026
Merged

docs: add conflict guidelines for tools.swc#6887
chenjiahan merged 2 commits intomainfrom
swc_doc_0104

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

Added a new section to the documentation describing how Rsbuild manages conflicts between jsc.target and env.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 4, 2026 14:43
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 4, 2026

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit cd153a8
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/695b0401d02b190008acb3ed
😎 Deploy Preview https://deploy-preview-6887--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 69 (🟢 up 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.target and env incompatibility
  • Documents Rsbuild's conflict handling strategies for both user-set jsc.target and output.polyfill scenarios

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`。
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此文档声称"Rsbuild 会自动移除内置的 env.targets"当手动设置 jsc.target 时。然而,检查 packages/core/src/plugins/swc.ts (第182-186行) 的实现,配置合并是使用 reduceConfigsdeepmerge 执行的,并没有检查 jsc.target 是否存在并移除 env.targets 的逻辑。

相关的 PR #6886 描述中提到添加检查以在检测到 jsc.target 时自动取消设置 env.targets,但此逻辑在当前实现中似乎不存在。要么需要更新实现以匹配此文档,要么应修改文档以准确反映当前行为。

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenjiahan chenjiahan merged commit 56dfc4c into main Jan 5, 2026
10 checks passed
@chenjiahan chenjiahan deleted the swc_doc_0104 branch January 5, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants