修复 semi-webpack/semi-rspack:支持匹配 @douyinfe/semi-ui-19 等带数字后缀包名 #3126
+20
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
关联 Issue: #3116(
@douyinfe/semi-webpack-plugin正则未匹配@douyinfe/semi-ui-19)问题概述
现有规则/正则仅匹配
@douyinfe/semi-(ui|icons|foundation)的固定包名形态,导致当依赖包名为@douyinfe/semi-ui-19(或类似带数字后缀)时无法命中,从而插件对应 loader/rule 不生效。解决方案
将 Semi 相关依赖的识别正则扩展为“可选数字后缀”形式(例如
semi-ui(-19)?),确保@douyinfe/semi-ui与@douyinfe/semi-ui-19均能被正确匹配,同时保持对semi-icons、semi-foundation的兼容。主要变更点
packages/semi-webpack/src/semi-webpack-plugin.ts:更新并复用匹配正则,支持@douyinfe/semi-ui-19等形态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)进行匹配逻辑手工校验,确保规则可命中并不影响原有包名匹配。