Skip to content

fix: publish source files referenced by source conditional exports - #10607

Open
Tyagiquamar wants to merge 1 commit into
adobe:mainfrom
Tyagiquamar:fix/source-export-resolution
Open

Tyagiquamar wants to merge 1 commit into
adobe:mainfrom
Tyagiquamar:fix/source-export-resolution

Conversation

@Tyagiquamar

Copy link
Copy Markdown

Closes #10397

Intent

react-aria, react-stately, and react-aria-components advertise a source conditional export (./exports/index.ts, ./exports/*.ts), but their published files excluded exports/** (and src/**, which the export shims re-export from). Any bundler opting into the source condition — e.g. Vite with resolve.conditions: ['source'], common in Storybook setups — resolves an entry that is absent from the installed package and fails with Failed to resolve import "react-aria/…".

Why this approach

Two options from the issue: drop the source condition, or publish the sources. Dropping it is not viable here: the monorepo itself resolves workspace packages through the source condition (customConditions: ["source"] in tsconfig.json / tsconfig.build.json), and every sibling package (@react-stately/*, @internationalized/*, @react-types/shared with no files allowlist at all) already publishes the sources its source condition points at. So this aligns the three outliers with the repo convention by removing the !exports/** and !src/** exclusions. I verified nothing under src//exports/ imports from the still-excluded dirs (stories, test, docs, example, intl), so the published sources are self-contained apart from workspace deps that already ship their own source.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices
  • I understand every change in this PR and can explain why it's there.
  • If AI-assisted, I followed our AI contribution guidance and pointed my assistant at CLAUDE.md.

No unit tests apply (packaging metadata only); verification below stands in for them. Accessibility practices do not apply (no component or interaction change).

AI disclosure: an AI assistant (Muse Spark, pointed at AGENTS.md per the contribution guide) helped investigate and verify; I reviewed the diff, confirmed the root cause against the published tarball layout, and own the change and follow-ups.

📝 Test Instructions:

  • npm pack --dry-run in packages/react-aria (and the other two): exports/*.ts and src/** are now listed, stories/**/test/** still excluded, tarball stays small (~339 kB packed for react-aria).
  • Simulate an installed package (package.json + exports/ + src/), then node --conditions=source -e "require.resolve('react-aria'); require.resolve('react-aria/I18nProvider')": both resolve to the .ts sources with the fix, and fail with MODULE_NOT_FOUND without it (matching the reported Vite failure).

🧢 Your Project:

Independent contributor; using React Aria with Vite + source conditions.

@github-actions github-actions Bot added the RAC label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

source conditional exports point to files omitted from npm packages

1 participant