Skip to content

fix(vapor): ship real per-component CSS via tsdown - #24

Merged
Mini-Sylar merged 1 commit into
mainfrom
fix/vapor-css-tree-shaking
Aug 10, 2026
Merged

fix(vapor): ship real per-component CSS via tsdown#24
Mini-Sylar merged 1 commit into
mainfrom
fix/vapor-css-tree-shaking

Conversation

@Mini-Sylar

Copy link
Copy Markdown
Owner

Summary

  • vael-ui/vapor (and the vapor export condition added in 0.2.1) shipped with zero CSS — the generator stripped every component's CSS import under the assumption a consumer already had styles loaded some other way. It now copies each component's CSS alongside its generated source and keeps the import, same as the vdom build.
  • vapor-ui's build moves from Vite library mode to tsdown, matching packages/ui's already-proven config, giving vapor the same real per-component CSS code-splitting.
  • tsdown's own dts generation is skipped for vapor-ui — Vapor SFCs type as plain function components under vue-tsc, which fails downstream template type-checking (abstract new (...args) => any constraint). Restored emit-vapor-types.mjs, which re-exports the vdom build's own DefineComponent types for the same components instead (type-only, erased at runtime, so the mismatch is harmless).

Verification

  • Real production vite build importing only Button via resolve.conditions: ['vapor']: 58.7KB JS + 9.8KB CSS, containing only Button — no other of the 69 components leaked.
  • Real browser render (Playwright) through the vapor condition: correct DOM, correct computed styles, zero console errors.
  • Full monorepo pnpm build, pnpm typecheck:only, and both test suites (691 + 16 tests) pass clean from a from-scratch rebuild.

Test plan

  • pnpm build (root) — clean
  • pnpm typecheck:only — clean
  • pnpm --filter vael-ui test — 691/691 passed
  • pnpm --filter vapor-ui test — 16/16 passed
  • Real vite build + Playwright render check against the vapor condition

vael-ui/vapor built with zero CSS at all — the generator stripped every
component's CSS import under the assumption a consumer already had styles
loaded some other way. It now copies each component's CSS alongside its
generated source and keeps the import, same as the vdom build.

vapor-ui's build also moves from Vite library mode to tsdown, matching
packages/ui's proven config, for real per-component CSS code-splitting.
tsdown's own dts generation is skipped (Vapor SFCs type as plain function
components, which fails downstream template type-checking) in favor of
the existing emit-vapor-types.mjs, which reuses the vdom build's
DefineComponent types instead.
@Mini-Sylar
Mini-Sylar merged commit ad501a0 into main Aug 10, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Aug 10, 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