Skip to content

fix: stabilize Mpx resolution and Tailwind v4 layer order#995

Merged
sonofmagic merged 8 commits into
mainfrom
codex/mpx-project-plugin-resolution
Jul 14, 2026
Merged

fix: stabilize Mpx resolution and Tailwind v4 layer order#995
sonofmagic merged 8 commits into
mainfrom
codex/mpx-project-plugin-resolution

Conversation

@sonofmagic

@sonofmagic sonofmagic commented Jul 13, 2026

Copy link
Copy Markdown
Owner

问题

  • Mpx 项目存在多个 @mpxjs/webpack-plugin peer 实例时,loader 可能绑定到不拥有当前 compilation 的插件实例,导致构建失败。
  • Tailwind CSS v4 用户 @layer 规则的插入位置依赖无缩进行首正则;生成 CSS 出现缩进后,base/components 会被追加到 utilities 后面。
  • legacy compat 会再次回放用户 layer CSS,导致规则重复,并可能误删同选择器但声明不同的未分层覆盖。

修复

  • 根据 Webpack compilation 已注册模板解析实际 Mpx 插件 owner,并让 loader 与依赖模板使用同一实例。
  • 使用 PostCSS AST 确定用户 layer 的插入位置,恢复 theme/preflight -> base -> components -> utilities -> unlayered 顺序。
  • 按完整规则声明去重 layer 回放,同时保留同选择器、不同声明值的未分层覆盖。
  • 调整 Windows Taro dev readiness 与独立分包预算,减少共享超时造成的误判;保留 Linux、Windows 与精简 macOS demo/watch 覆盖。
  • 刷新普通 static gateway 与 apps-generator static gateway 快照。

回归覆盖

  • Mpx 多 peer 实例、plugin owner 与 compilation 归属单测。
  • indented selector 下的 AST layer 定位与精确去重单测。
  • legacy compat 同选择器不同声明覆盖保留单测。
  • uni-app Vite v4 小程序产物断言:base < components < utilities < unlayered,且 layer 规则仅输出一次。
  • uni-app、Taro Vite、Taro Webpack、weapp-vite、Mpx 的 static 产物快照。
  • uni-app Vite watch/HMR 的 template、script、style、content、arbitrary class、rollback 与分包路径。

本地验证

  • pnpm --filter weapp-tailwindcss lint
  • pnpm --filter weapp-tailwindcss build
  • generator/legacy/layer 单测:180 passed
  • Vite layer/cascade 回归:2 passed
  • 7 个 framework static project suites:27 passed,66 snapshots
  • apps-generator comparison:7 passed,73 snapshots
  • uni-app production mp-weixin build
  • uni-app Vite 完整 watch/HMR 回归
  • pnpm exec changeset status --since origin/main
  • git diff --check

完整 package test 当前为 2805 passed、10 failed;失败均为与本次改动无关的既有 PostCSS/Vite fixture 缩进快照差异,本 PR 未顺带更新这些无关基线。

Changeset

包含 patch changeset,中文说明 Mpx 多实例解析与 Tailwind v4 layer 顺序、重复回放修复。

@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fd4a256

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
weapp-tailwindcss Patch
@weapp-tailwindcss/build-all Patch
@weapp-tailwindcss/website Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sonofmagic sonofmagic changed the title fix(mpx): prefer the project webpack plugin instance fix(mpx): bind loaders to compilation plugin owner Jul 13, 2026
@sonofmagic sonofmagic changed the title fix(mpx): bind loaders to compilation plugin owner fix: stabilize Mpx resolution and Tailwind v4 layer order Jul 14, 2026
@sonofmagic sonofmagic merged commit 2372a36 into main Jul 14, 2026
64 of 67 checks passed
@sonofmagic sonofmagic mentioned this pull request Jul 14, 2026
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.

1 participant