Skip to content

Conversation

@SudoUserReal
Copy link
Collaborator

修复 Issue #3116@douyinfe/semi-webpack-plugin(以及对应的 semi-rspack 规则)在通过 module.resource 路径正则识别 Semi 相关依赖时,仅匹配 @douyinfe/semi-(ui|icons|foundation),导致 @douyinfe/semi-ui-19/lib/... 这类带数字后缀的包名无法命中,从而相关 loader/规则不生效。

解决方案

将依赖识别正则扩展为支持可选的 -数字 后缀(如 semi-ui-19),并保持对原有 semi-ui / semi-icons / semi-foundation 的兼容;同时在 semi-rspack 中对齐相同的匹配逻辑。

主要变更点

  • 更新 packages/semi-webpack/src/semi-webpack-plugin.ts:扩展 Semi 依赖路径匹配正则,覆盖 @douyinfe/semi-ui-<number> 形态
  • 更新 packages/semi-webpack/README.md:补充说明支持带数字后缀的 Semi 包名
  • 更新 packages/semi-rspack/src/rule.ts:对齐相同的包名匹配规则,避免 rspack 场景同类问题
  • 更新 packages/semi-rspack/README.md:同步文档说明

测试说明

  • 本次修改为匹配逻辑与文档更新;仓库内该包未见现成自动化用例覆盖该正则场景
  • 建议在项目中分别引入 @douyinfe/semi-ui@douyinfe/semi-ui-19 验证对应规则/loader 是否均能生效(webpack 与 rspack 场景各验证一次)

This commit was automatically generated by Semi Issue Solver.
Closes #3116
omitCss(module: any) {
const compatiblePath = transformPath(module.resource);
if (/@douyinfe\/semi-(ui|icons)\/lib\/.+\.js$/.test(compatiblePath)) {
if (SEMI_LIB_JS_RE.test(compatiblePath)) {

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '@douyinfe/semi-ui/lib/' and with many repetitions of '@douyinfe/semi-ui/lib/'.
customTheme(module: any) {
const compatiblePath = transformPath(module.resource);
if (/@douyinfe\/semi-(ui|icons)\/lib\/.+\.js$/.test(compatiblePath)) {
if (SEMI_LIB_JS_RE.test(compatiblePath)) {

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '@douyinfe/semi-ui/lib/' and with many repetitions of '@douyinfe/semi-ui/lib/'.
});
}
if (/@douyinfe\/semi-(ui|icons|foundation)\/lib\/.+\.scss$/.test(compatiblePath)) {
if (SEMI_LIB_SCSS_RE.test(compatiblePath)) {

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '@douyinfe/semi-ui/lib/' and with many repetitions of '@douyinfe/semi-ui/lib/'.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 2, 2026

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 72ccff0:

Sandbox Source
pr-story Configuration

@cypress
Copy link

cypress bot commented Feb 2, 2026

semi-design    Run #3446

Run Properties:  status check passed Passed #3446  •  git commit 8e82e219f6 ℹ️: Merge 72ccff08a5f04cb85e3e1312f92e7720b6096844 into d56dc3df4f84819caa7e98a49e9d...
Project semi-design
Branch Review solve/issue-3116-1770017038039
Run status status check passed Passed #3446
Run duration 08m 17s
Commit git commit 8e82e219f6 ℹ️: Merge 72ccff08a5f04cb85e3e1312f92e7720b6096844 into d56dc3df4f84819caa7e98a49e9d...
Committer SudoUser
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 13
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 291
View all changes introduced in this branch ↗︎

@SudoUserReal
Copy link
Collaborator Author

PR 关闭原因:

关闭

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