fix: publish source files referenced by source conditional exports - #10607
Open
Tyagiquamar wants to merge 1 commit into
Open
Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
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.
Closes #10397
Intent
react-aria,react-stately, andreact-aria-componentsadvertise asourceconditional export (./exports/index.ts,./exports/*.ts), but their publishedfilesexcludedexports/**(andsrc/**, which the export shims re-export from). Any bundler opting into thesourcecondition — e.g. Vite withresolve.conditions: ['source'], common in Storybook setups — resolves an entry that is absent from the installed package and fails withFailed to resolve import "react-aria/…".Why this approach
Two options from the issue: drop the
sourcecondition, or publish the sources. Dropping it is not viable here: the monorepo itself resolves workspace packages through thesourcecondition (customConditions: ["source"]intsconfig.json/tsconfig.build.json), and every sibling package (@react-stately/*,@internationalized/*,@react-types/sharedwith nofilesallowlist at all) already publishes the sources itssourcecondition points at. So this aligns the three outliers with the repo convention by removing the!exports/**and!src/**exclusions. I verified nothing undersrc//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:
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-runinpackages/react-aria(and the other two):exports/*.tsandsrc/**are now listed,stories/**/test/**still excluded, tarball stays small (~339 kB packed for react-aria).exports/+src/), thennode --conditions=source -e "require.resolve('react-aria'); require.resolve('react-aria/I18nProvider')": both resolve to the.tssources with the fix, and fail withMODULE_NOT_FOUNDwithout it (matching the reported Vite failure).🧢 Your Project:
Independent contributor; using React Aria with Vite +
sourceconditions.