Skip to content

fix: 跳过 Tailwind source 排除的 Vite JS chunk#934

Draft
sonofmagic wants to merge 2 commits into
mainfrom
codex/issue-932-large-ts-slow-build
Draft

fix: 跳过 Tailwind source 排除的 Vite JS chunk#934
sonofmagic wants to merge 2 commits into
mainfrom
codex/issue-932-large-ts-slow-build

Conversation

@sonofmagic

@sonofmagic sonofmagic commented Jun 17, 2026

Copy link
Copy Markdown
Owner

概要

  • 在 Vite build 阶段,根据 Tailwind v4 @source / @source not 解析出的 source entries 判断 Rollup chunk 来源模块。
  • 当 JS chunk 的模块全部落在 Tailwind source 排除范围外时,跳过 JS AST 转译,避免大型生成 TS 文件拖慢构建。
  • 对缺少 module id 的 chunk 保持保守处理,不跳过;watch-like / serve 流程也不启用该跳过逻辑,避免影响增量候选链路。
  • 补充 issue [Bug]: 在包含大型文件时构建项目非常慢 #932 回归测试,以及 Tailwind v4 source negation 匹配单测。
  • weapp-tailwindcss 补充中文 patch changeset。

Fixes #932

验证

  • pnpm --filter weapp-tailwindcss exec vitest run test/bundlers/vite-plugin.bundle.unit.test.ts -t "skips js chunks whose modules are excluded" --reporter verbose
  • pnpm --filter weapp-tailwindcss exec vitest run test/tailwindcss/source-scan.unit.test.ts --reporter verbose
  • pnpm --filter weapp-tailwindcss build
  • git diff --check

说明

  • 合并最新 origin/main 后,上述定向验证和包构建均已通过。
  • 完整运行 pnpm --filter weapp-tailwindcss exec vitest run test/bundlers/vite-plugin.bundle.unit.test.ts --reporter dot 时,仍存在 3 个既有 dev/watch CSS replay 或 dirty-state 相关失败:keeps dirty state stable when bundle temporarily omits js entriesreplays updated vite pipeline main css into uni-app dev app.wxssrefreshes uni-app dev app.wxss from script-only escaped v4 hmr candidates without force refresh env。这些失败与本次 build-only source-scope skip 无关;本次 issue 的定向回归已通过。
  • node --import tsx scripts/check-create-weapp-vite-changeset.tsnode --import tsx scripts/check-catalog-changeset.ts 无法运行,因为当前 checkout 中不存在这些脚本,报错为 ERR_MODULE_NOT_FOUND
  • pnpm --filter weapp-tailwindcss exec tsc --noEmit --pretty false 在当前仓库结构下不是可用的包级检查:该命令会把仓库级 e2e / tools 文件拉进 packages/weapp-tailwindcss 的 rootDir 外,导致既有 rootDir/type 错误;包构建及类型构建已通过。

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 524c99d

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: skip Vite JS chunks excluded by Tailwind sources fix: 跳过 Tailwind source 排除的 Vite JS chunk Jun 17, 2026
@sonofmagic sonofmagic marked this pull request as draft June 17, 2026 11:45
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.

[Bug]: 在包含大型文件时构建项目非常慢

1 participant