fix(vite-runner): 复用相同 CSS 时生成全部页面样式 - #19492
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. Walkthrough样式插件现在为共享 CSS 资源生成对应的多个页面样式文件,并保留应用样式与公共样式的导入关系。PR 新增 Vitest 测试、覆盖率配置和测试脚本。 Changes小程序样式资源输出
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. 小兔捧来样式包, Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19492 +/- ##
==========================================
+ Coverage 54.55% 54.63% +0.07%
==========================================
Files 463 464 +1
Lines 25349 25391 +42
Branches 6341 6373 +32
==========================================
+ Hits 13830 13872 +42
+ Misses 9664 9503 -161
- Partials 1855 2016 +161
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
2d3228e to
82c0a92
Compare
82c0a92 to
2f7c38d
Compare
这个 PR 做了什么? (简要描述所做更改)
修复 Vite 小程序构建中,多个页面因样式内容相同而复用同一个 CSS asset 时,只有最后一个页面生成样式文件的问题。
Vite 会把相同样式合并为同一个
importedCssasset。原实现遍历每个 chunk 时直接覆盖该 asset 的fileName,所以前一个页面的.wxss路径会被后一个页面覆盖。本改动:emitFile为其余目标生成同源 asset;app-origin和 common style 包装逻辑继续生效;@tarojs/vite-runner增加 Vitest 回归测试,覆盖页面共享 CSS、app/page 共享 CSS,以及有无 app CSS 时的 common styles 行为。验证结果:
pnpm build:serialpnpm lintpnpm --filter @tarojs/vite-runner test:ci(4 tests passed;style.ts100% lines / 92.3% branches)pages/index/index.wxss;替换为本次构建产物后,pages/index/index.wxss与pages/list/index.wxss均生成并包含.ct-page。Fixes #19485
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit
改进
测试