Fix compat with extensionless scripts/* imports - #57718
Closed
huntie wants to merge 1 commit into
Closed
Conversation
Summary: **Context** Replaces react#57709, which identified a real bug in 0.87 from the combination of: - react#57276 - react#57652 ``` $ npx react-native spm add error Cannot find module '.../node_modules/react-native/scripts/setup-apple-spm' $ npx react-native codegen error Cannot find module '.../node_modules/react-native/scripts/codegen/generate-artifacts-executor' ``` **This diff** - Fix — and exclusively switch to — extensionless imports rather than requiring `.js`. - Update in-repo consumers. The previous single mapping is now an extension-aware mapping: - `./scripts/*` now appends `.js`, so `react-native/scripts/foo` resolves to `foo.js`. - `.sh` and `.rb` stay reachable via explicit `./scripts/*.sh` and `./scripts/*.rb` passthrough patterns. **Impact** - Explicit `react-native/scripts/*.js` specifiers no longer resolve, so JavaScript paths must be imported without an extension. - Files under `scripts/` with extensions other than `.js`, `.sh`, or `.rb` are no longer exposed through `./scripts/*`. - These have no open source consumers. Changelog: [General][Fixed] - (RC4 only, drop for main changelog): `react-native/scripts/*` imports once again expand `.js` extensions [General][Breaking] - Extensionless `react-native/scripts/*` imports are now **mandated**; explicit `.js` import specifiers are rejected. Differential Revision: D113898792
|
@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D113898792. |
chrfalch
approved these changes
Jul 28, 2026
chrfalch
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for fixing this!
|
This pull request has been merged in 97727ba. |
chrfalch
added a commit
that referenced
this pull request
Jul 28, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Summary:
Context
Replaces #57709, which identified a real bug in 0.87 from the combination of:
Thanks @chrfalch for raising this!
This diff
.js.The previous single mapping is now an extension-aware mapping:
./scripts/*now appends.js, soreact-native/scripts/fooresolves tofoo.js..shand.rbstay reachable via explicit./scripts/*.shand./scripts/*.rbpassthrough patterns.Impact
react-native/scripts/*.jsspecifiers no longer resolve, so JavaScript paths must be imported without an extension.scripts/with extensions other than.js,.sh, or.rbare no longer exposed through./scripts/*.Changelog:
[General][Fixed] - (RC4 only, drop for main changelog):
react-native/scripts/*imports once again expand.jsextensions[General][Breaking] - Extensionless
react-native/scripts/*imports are now mandated; explicit.jsimport specifiers are rejected.Differential Revision: D113898792