Repository navigation
fix(vite-runner): 修复小程序页面模板缺少 page-meta 导致 PageMeta 失效的问题 - #19500
Conversation
|
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调整小程序模板生成流程:提前构建并复用 Changes模板生成流程
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to 该变更修复页面元数据传递与模板生成时序,未发现阻碍合并的问题。 🚥 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 |
页面模板先于 base 模板生成,导致: 1. buildPageTemplate 未收到页面配置,平台覆写(如微信小程序)拿不到 enablePageMeta; 2. 覆写读取的 transferComponents 依赖 buildTemplate 填充,此时仍为空。 与 webpack5 编译器(MiniPlugin)行为对齐。fix NervJS#16900
7eb444f to
7f21e09
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19500 +/- ##
=======================================
Coverage 55.70% 55.70%
=======================================
Files 451 451
Lines 23779 23779
Branches 5872 5918 +46
=======================================
Hits 13247 13247
- Misses 8652 8685 +33
+ Partials 1880 1847 -33
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
fix #16900
问题
vite 编译小程序时,页面 wxml 缺少
<page-meta>节点:配置了enablePageMeta的页面里使用<PageMeta>完全失效(webpack5 编译器无此问题)。Taro 4.0.5 ~ 4.2.1 均可复现。原因
packages/taro-vite-runner/src/mini/emit.ts生成页面模板时存在两个问题:buildPageTemplate时未传入页面配置,平台覆写(如 微信小程序)拿不到enablePageMeta,不会生成 page-meta 片段;transferComponents依赖buildTemplate填充,此时仍为空。修复
buildPageTemplate传入{ content: pageConfig, path: page.name },与 webpack5 编译器(MiniPlugin)行为对齐。验证
dist/pages/index/index.wxml只有<import src="../../base.wxml"/><template is="taro_tmpl"/>;<page-meta ... page-style="{{pageMeta.p5||''}}" ...>;pnpm --filter @tarojs/vite-runner run build(tsc)与 ESLint 均通过。Summary by CodeRabbit