Skip to content

fix(classic): fix classic web build failures - #5892

Merged
t0ng7u merged 2 commits into
mainfrom
fix/classic-web-build
Jul 4, 2026
Merged

t0ng7u merged 2 commits into
mainfrom
fix/classic-web-build

Conversation

@QuentinHsu

@QuentinHsu QuentinHsu commented Jul 4, 2026 •

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

问题描述

  • classic 前端构建会因为 react-icons/si 不存在 SiSlack 导出而失败。
  • Semi 依赖的 [email protected] 会解析到根部 date-fns@4,触发 package exports 兼容性错误。
  • makefile 中仍存在 backend 命名,与现有 web/api 命名约定不一致。

修复方式

  • 将 Slack OAuth 图标改为 react-icons/fa 提供的 FaSlack。
  • 在 classic Rsbuild 配置中将 date-fns alias 到 Semi 自带的 date-fns v2 副本。
  • 将 makefile 中 backend 相关变量、目标和提示文案统一改为 api。

测试说明

  • 已执行 make build-web-classic,构建通过。
  • 已执行 make -n all 和 make -n dev-api-rebuild,目标解析正常。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • Bug Fixes
    • Updated the Slack sign-in icon to use the standard Slack branding.
    • Improved dependency resolution for a UI package to help the app load consistently in the classic web experience.
  • Chores
    • Renamed local development commands and labels from “backend” to “api” for clearer setup and restart workflows.

- replace the Slack OAuth icon with FaSlack from react-icons/fa to avoid the missing SiSlack export.
- add a classic Rsbuild alias for date-fns so Semi resolves its compatible date-fns v2 dependency.
- rename Makefile variables and targets from backend to api for naming consistency.
- update dev command messages and reset setup restart flow to use api terminology.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR contains three unrelated changes: a makefile rename from backend to API naming for local dev/reset targets, an rsbuild config addition that aliases date-fns to a path under Semi UI's bundled dependency, and a Slack OAuth icon swap from Simple Icons to FontAwesome.

Changes

Makefile API Rename

Layer / File(s) Summary
Rename backend variables and targets to api
makefile
BACKEND_DIR/DEV_BACKEND_SERVICE renamed to API_DIR/DEV_API_SERVICE; start-backend replaced by start-api; dev-api-rebuild build target and reset-setup restart target/messages updated accordingly.

date-fns Alias Resolution

Layer / File(s) Summary
Add date-fns alias
web/classic/rsbuild.config.ts
Adds semiDateFnsDir path resolution and maps resolve.alias['date-fns'] to it.

Slack Icon Swap

Layer / File(s) Summary
Swap Slack icon
web/classic/src/helpers/render.jsx
Replaces SiSlack import and mapping with FaSlack.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • QuantumNous/new-api#5719: Removes the date-fns/date-fns-tz resolve/alias setup in the same rsbuild.config.ts file that this PR modifies.

Poem

A rabbit hops through makefile lines,
Renaming "backend" where "api" now shines,
A date-fns path resolved just right,
And Slack's icon swapped to a new flight,
Hop, hop, hooray! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: fixing classic web build failures in the classic web area.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/classic-web-build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/classic/rsbuild.config.ts (1)

13-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Fragile relative-path traversal to locate nested date-fns.

semiDateFnsDir is derived by hardcoding '../semi-foundation/node_modules/date-fns' relative to semiUiDir. This assumes a specific package layout (semi-foundation as a sibling scope folder with its own un-hoisted date-fns), which can silently break if package hoisting differs across package managers/versions, or if semi-ui's entry-file depth changes in a future release — with no existence check or fallback if the path is wrong.

Consider resolving via Node's module resolution instead of manual relative traversal, e.g.:

♻️ Suggested more robust resolution
-const semiDateFnsDir = path.resolve(
-  semiUiDir,
-  '../semi-foundation/node_modules/date-fns',
-)
+const semiDateFnsDir = path.dirname(
+  require.resolve('date-fns/package.json', {
+    paths: [require.resolve('`@douyinfe/semi-foundation/package.json`')],
+  }),
+)

This resolves the actual installed date-fns used by semi-foundation regardless of hoisting/layout differences.

Also applies to: 54-54

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/classic/rsbuild.config.ts` around lines 13 - 16, The `semiDateFnsDir`
resolution in `rsbuild.config.ts` is brittle because it hardcodes a relative
traversal from `semiUiDir` to `semi-foundation/node_modules/date-fns`. Replace
that manual path construction with Node module resolution so the config locates
the installed `date-fns` for `semi-foundation` regardless of hoisting or package
layout changes. Update the related `semiDateFnsDir` usage and any other mirrored
resolution in the same config so both references use the same robust lookup
path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@web/classic/rsbuild.config.ts`:
- Around line 13-16: The `semiDateFnsDir` resolution in `rsbuild.config.ts` is
brittle because it hardcodes a relative traversal from `semiUiDir` to
`semi-foundation/node_modules/date-fns`. Replace that manual path construction
with Node module resolution so the config locates the installed `date-fns` for
`semi-foundation` regardless of hoisting or package layout changes. Update the
related `semiDateFnsDir` usage and any other mirrored resolution in the same
config so both references use the same robust lookup path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4de765b5-957e-462e-b426-a1b1bd2aa615

📥 Commits

Reviewing files that changed from the base of the PR and between b6e8ff9 and a130103.

📒 Files selected for processing (3)
  • makefile
  • web/classic/rsbuild.config.ts
  • web/classic/src/helpers/render.jsx

@t0ng7u
t0ng7u merged commit 722d036 into main Jul 4, 2026
1 check passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 6, 2026
11 tasks
Jacobinwwey pushed a commit to Jacobinwwey/new-api that referenced this pull request Jul 11, 2026
Merge pull request QuantumNous#5892 from QuantumNous/fix/classic-web-build
@coderabbitai coderabbitai Bot mentioned this pull request Jul 14, 2026
8 of 11 tasks
@Calcium-Ion
Calcium-Ion deleted the fix/classic-web-build branch July 21, 2026 06:46
zhaodechao2008 pushed a commit to zhaodechao2008/new-api that referenced this pull request Jul 27, 2026
Merge pull request QuantumNous#5892 from QuantumNous/fix/classic-web-build
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
Merge pull request QuantumNous#5892 from QuantumNous/fix/classic-web-build
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
Merge pull request QuantumNous#5892 from QuantumNous/fix/classic-web-build
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
Merge pull request QuantumNous#5892 from QuantumNous/fix/classic-web-build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants