Skip to content

Migrate build system from Vite to tsdown#163

Merged
bartveneman merged 5 commits intomainfrom
claude/replace-vite-tsdown-9Hraq
Mar 8, 2026
Merged

Migrate build system from Vite to tsdown#163
bartveneman merged 5 commits intomainfrom
claude/replace-vite-tsdown-9Hraq

Conversation

@bartveneman
Copy link
Copy Markdown
Member

Summary

This PR migrates the project's build system from Vite to tsdown, simplifying the build configuration and improving ES module output consistency.

Key Changes

  • Build tool migration: Replaced Vite with tsdown as the primary build tool

    • Removed vite.config.ts and tsconfig.build.json
    • Added tsdown.config.ts with entry points for all library exports
    • Updated build script from vite build && tsc to just tsdown
  • Output file extensions: Changed generated file extensions for consistency

    • JavaScript files: .js.mjs (explicit ES module)
    • TypeScript declarations: .d.ts.d.mts (matching module format)
    • Updated all export paths in package.json and test files
  • Dependency updates:

    • Removed: vite, publint, @codecov/vite-plugin
    • Added: tsdown, @codecov/rollup-plugin
    • Integrated publint validation directly into tsdown config
  • CI/CD simplification: Removed dedicated lint-package workflow job that ran publint separately (now handled by tsdown)

  • Test updates: Updated all import paths in test/build/exports.test.ts to reference .mjs and .d.mts files

Implementation Details

The tsdown configuration maintains the same entry points as the previous Vite setup, ensuring all library exports remain accessible. The publint validation is now integrated into the build process via tsdown's built-in support, eliminating the need for a separate linting step.

https://claude.ai/code/session_01RDMRwtqcxjAab9FfApm26G

claude added 2 commits March 8, 2026 13:17
- Add tsdown.config.ts with multiple entry points, dts, publint, and
  codecovRollupPlugin for bundle analysis
- Remove vite.config.ts and tsconfig.build.json (tsdown handles both
  bundling and DTS generation)
- Switch build script from "vite build && tsc --project tsconfig.build.json"
  to "tsdown"
- Remove lint-package script and lint-package CI job (publint now runs
  as part of the build via tsdown's publint: true)
- Swap @codecov/vite-plugin for @codecov/rollup-plugin
- Remove publint and vite devDependencies; add tsdown ^0.21.0
- Remove overrides block (was only needed for vite plugin)
- Update package.json exports from .js/.d.ts to .mjs/.d.mts to match
  tsdown's default ESM output
- Update build test imports to use .mjs extensions

https://claude.ai/code/session_01RDMRwtqcxjAab9FfApm26G
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 8, 2026

Bundle Report

Changes will increase total bundle size by 8.42kB (5.59%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
@projectwallace/css-parser-esm 159.07kB 8.42kB (5.59%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: @projectwallace/css-parser-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
css-node-2ejJUrIw.js (New) 20.73kB 20.73kB 100.0% 🚀
parse-atrule-prelude.js (New) 20.68kB 20.68kB 100.0% 🚀
parse-selector.js (New) 19.88kB 19.88kB 100.0% 🚀
tokenize-BQFB1jXg.js (New) 18.26kB 18.26kB 100.0% 🚀
css-node-DqyvMXBN.d.ts (New) 13.29kB 13.29kB 100.0% 🚀
parse.js -3.15kB 10.55kB -23.02%
index.d.ts (New) 8.77kB 8.77kB 100.0% 🚀
parse-anplusb.js (New) 7.23kB 7.23kB 100.0% 🚀
parse-value.js (New) 6.83kB 6.83kB 100.0% 🚀
index.js 4.28kB 6.22kB 220.58% ⚠️
parse-declaration.js (New) 6.02kB 6.02kB 100.0% 🚀
parse-dimension-CCn_XRDe.js (New) 5.17kB 5.17kB 100.0% 🚀
tokenize-odLrcjj2.d.ts (New) 4.86kB 4.86kB 100.0% 🚀
parse-utils-DnsZRpfd.js (New) 2.84kB 2.84kB 100.0% 🚀
parse-atrule-prelude.d.ts (New) 1.62kB 1.62kB 100.0% 🚀
parse-selector.d.ts (New) 1.43kB 1.43kB 100.0% 🚀
parse.d.ts (New) 1.28kB 1.28kB 100.0% 🚀
parse-value.d.ts (New) 949 bytes 949 bytes 100.0% 🚀
parse-declaration.d.ts (New) 837 bytes 837 bytes 100.0% 🚀
parse-anplusb.d.ts (New) 732 bytes 732 bytes 100.0% 🚀
parse-dimension.d.ts (New) 536 bytes 536 bytes 100.0% 🚀
tokenize.d.ts (New) 161 bytes 161 bytes 100.0% 🚀
parse-dimension.js (New) 98 bytes 98 bytes 100.0% 🚀
tokenize.js -19.03kB 96 bytes -99.5%
parse-*.js (Deleted) -25.9kB 0 bytes -100.0% 🗑️
parse-*.js (Deleted) -8.48kB 0 bytes -100.0% 🗑️
parse-*.js (Deleted) -1.02kB 0 bytes -100.0% 🗑️
parse-*.js (Deleted) -7.36kB 0 bytes -100.0% 🗑️
parse-*.js (Deleted) -25.97kB 0 bytes -100.0% 🗑️
parse-*.js (Deleted) -1.77kB 0 bytes -100.0% 🗑️
parse-*.js (Deleted) -8.47kB 0 bytes -100.0% 🗑️
css-*.js (Deleted) -16.29kB 0 bytes -100.0% 🗑️
arena.js (Deleted) -11.07kB 0 bytes -100.0% 🗑️
string-*.js (Deleted) -3.58kB 0 bytes -100.0% 🗑️
constants.js (Deleted) -2.1kB 0 bytes -100.0% 🗑️
char-*.js (Deleted) -1.46kB 0 bytes -100.0% 🗑️
walk.js (Deleted) -1.24kB 0 bytes -100.0% 🗑️
token-*.js (Deleted) -1.15kB 0 bytes -100.0% 🗑️

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.92%. Comparing base (8a8689d) to head (67d69f1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #163   +/-   ##
=======================================
  Coverage   94.92%   94.92%           
=======================================
  Files          16       16           
  Lines        2797     2797           
  Branches      736      736           
=======================================
  Hits         2655     2655           
  Misses        142      142           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

claude and others added 3 commits March 8, 2026 14:58
Use outExtensions in tsdown config to output .js and .d.ts instead of
the default .mjs/.d.mts, so codecov can compare bundle sizes against
the existing baseline.

https://claude.ai/code/session_01RDMRwtqcxjAab9FfApm26G
platform: neutral sets fixedExtension=false, which combined with
"type": "module" in package.json causes tsdown to output .js files
by default — no need for an explicit outExtensions override.

https://claude.ai/code/session_01RDMRwtqcxjAab9FfApm26G
@bartveneman bartveneman merged commit ea84a53 into main Mar 8, 2026
4 checks passed
@bartveneman bartveneman deleted the claude/replace-vite-tsdown-9Hraq branch March 8, 2026 20:24
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.

3 participants