fix(themes): add tsup build to produce proper JS/TS module output - #541
Merged
Conversation
Theme packages only ran `xds build-theme` which produces CSS and theme-named JS files (e.g. default.js, neutral.js). But package.json exports point to index.js/index.mjs/index.d.ts which didn't exist. Changes: - Add tsup.config.ts to each theme package (default, neutral, brutalist) - Update build scripts to run both `xds build-theme` (CSS) and `tsup` (JS/TS modules) - Clean up stale theme-named JS/DTS files after build - Fix brutalist package.json exports to use dist/ instead of src/ - Fix exports condition ordering: types before import/require Each theme now produces: dist/index.js (CJS) dist/index.mjs (ESM) dist/index.d.ts (types) dist/index.d.mts (types) dist/theme.css (CSS theme) Co-authored-by: Navi <navi@navibot.dev>
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Theme packages (
@xds/theme-default,@xds/theme-neutral,@xds/theme-brutalist) only ranxds build-themewhich produces CSS and theme-named JS files (e.g.default.js,neutral.js). Butpackage.jsonexports point toindex.js/index.mjs/index.d.tswhich didn't exist.The v0.0.2 release manually patched
package.jsonto point todefault.js/neutral.js, but the underlying build was still broken — those files reference./iconswhich doesn't exist indist/.Fix
Each theme package now runs both build steps:
xds build-theme— producestheme.css(the CSS custom properties)tsup— compilessrc/index.tsto proper CJS/ESM/DTS outputChanges
Added
tsup.config.tsto each theme package (default,neutral,brutalist)src/index.tsclean: falseto preservetheme.cssfrom the prior build step@xds/core,@stylexjs/stylex,react, and theme-specific icon librariesUpdated build scripts to chain both commands and clean up stale artifacts:
Fixed brutalist
package.json— was pointingmain/types/exportsat./src/index.tsinstead ofdist/outputFixed exports condition ordering —
typesnow comes beforeimport/require(matches@xds/coreconvention, avoids esbuild warnings)Output
Each theme now produces:
Verification
yarn build✅ — all packages build successfullyyarn test✅ — 89 test files, 1428 tests passyarn lint✅ — 0 errors (pre-existing warnings only)dist/directories contain the expected filesdefault.js/neutral.js/brutalist.jsartifacts remain