Skip to content

deps(tsdown): migrate monorepo build/bundling to tsdown#21659

Draft
kennylam wants to merge 25 commits intocarbon-design-system:mainfrom
kennylam:deps/tsdown
Draft

deps(tsdown): migrate monorepo build/bundling to tsdown#21659
kennylam wants to merge 25 commits intocarbon-design-system:mainfrom
kennylam:deps/tsdown

Conversation

@kennylam
Copy link
Member

This migrates all build and bundling workflows from Rollup to tsdown. Previously project builds averaged 2m50s. With tsdown, the average (on my computer) is just over 1 minute, a reduction of ~63%.

Changelog

New

  • tsdown added as build/bundler for all packages

Changed

  • updated all build scripts to use tsdown
  • updated all package.json build scripts
  • replaced rollup-specific tooling in web components wherever possible
  • updated rollup-specific comments/docs
  • web components build:cdn now runs in CI/CD only

Removed

  • removed Rollup and Rollup plugins
  • removed react-router example since this exists in react-router-vite

Testing / Reviewing

The project should build with no errors. All CI tests and checks should pass. No visual changes were made.

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • [ ] Wrote passing tests that cover this change
  • [ ] Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@kennylam kennylam requested review from a team as code owners February 25, 2026 22:37
@kennylam kennylam marked this pull request as draft February 25, 2026 22:37
@kennylam kennylam requested a review from tay1orjones February 25, 2026 22:38
@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 5f136eb
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/699f79ac4ad1970008a690c1
😎 Deploy Preview https://deploy-preview-21659--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 5f136eb
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/699f79adf88e19000852ad10
😎 Deploy Preview https://deploy-preview-21659--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1ba044d
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/699f79f4c3ecfc0008433b5f
😎 Deploy Preview https://deploy-preview-21659--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 1ba044d
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/699f79f432bc0c00086e4c4f
😎 Deploy Preview https://deploy-preview-21659--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 6.25000% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.99%. Comparing base (eeef824) to head (1ba044d).

Files with missing lines Patch % Lines
...s/icon-build-helpers/src/builders/react/builder.js 0.00% 15 Missing and 2 partials ⚠️
...ackages/icon-build-helpers/src/builders/vanilla.js 0.00% 14 Missing and 2 partials ⚠️
...ges/icon-build-helpers/src/builders/vue/builder.js 0.00% 14 Missing and 2 partials ⚠️
...ages/icon-build-helpers/src/builders/react/next.js 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21659      +/-   ##
==========================================
+ Coverage   87.37%   93.99%   +6.61%     
==========================================
  Files         538      537       -1     
  Lines       43505    43532      +27     
  Branches     6684     6279     -405     
==========================================
+ Hits        38014    40916    +2902     
+ Misses       5329     2467    -2862     
+ Partials      162      149      -13     
Flag Coverage Δ
main-packages 86.62% <6.25%> (-0.26%) ⬇️
web-components 97.88% <ø> (+10.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@tay1orjones
Copy link
Member

tay1orjones commented Feb 26, 2026

@kennylam I worked with an agent on some approaches to diff this vs main and landed with some good intel.

Result

I diffed generated artifacts across tsdown vs main, excluding all node_modules, and produced a complete path-level inventory.

  • Total generated-file diffs: 61,580
  • Changed content: 60,030
  • Only in tsdown: 328
  • Only in main: 1,222

Highest-risk differences

  1. @carbon/utilities subpath files removed in tsdown build output.

    • main has es/* and lib/* submodules (carousel/dateTime/etc).
    • tsdown only has es/index.js and lib/index.js.
    • This can break consumers using deep imports (common in older setups, including webpack v4 apps).
  2. @carbon/utilities-react subpath files removed similarly.

    • StepFlow/* and useNoInteractiveChildren/index.js present in main, absent in tsdown.
    • Same deep-import break risk.
  3. @carbon/react declaration-file coverage regressed.

    • Many .d.ts files exist only in main (component/internal subpaths).
    • In tsdown, 76 additional JS files in each of es and lib lack sibling .d.ts.
    • TypeScript consumers importing subpaths can lose typings or fail type checks.
  4. @carbon/icon-helpers declarations missing in tsdown.

    • .d.ts files under es/lib/umd exist in main only.
  5. @carbon/web-components generated outputs differ structurally.

    • packages/web-components/dist exists in main and is absent in tsdown (build script behavior changed).
    • es-custom has different emitted auxiliary files (e.g. extra *2.js in tsdown, *.scss.js + maps in main).

Notable broad churn (content changed)

  • packages/icons and packages/icons-vue: 20,871 files each changed.
  • packages/pictograms-react: 6,180
  • packages/icons-react: 5,276
  • packages/web-components: 2,295
  • packages/react: 1,424

Most of this is codegen/layout/runtime-wrapper churn, but the missing-file classes above are the likely consumer-breaking deltas.

Thoughts

  • nothing hugely breaking? seems like a great start. pretty wild!
  • packages/web-components/dist missing is due to the build:cdn change you mentioned
@tay1orjones
Copy link
Member

Also once we've got parity straightened out, I'd love to switch the ci here to the smaller/normal runner and see if the OOM issues are resolved at all.

@kennylam
Copy link
Member Author

kennylam commented Feb 27, 2026

@tay1orjones Damn good catches. The one thing I did not do is consume this in any sort of standalone app. I'll look into the issues you mentioned.

packages/web-components/dist missing is due to the build:cdn change you mentioned

This is actually intentional. The dist artifacts only ever get used from the CDN. There's no need to bundle them and add to the bloat. And since they're never needed for local builds, there's no need to run that flow from working copies. They only need to get built/pushed from CI/CD, and that saves us a little build time locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants