Skip to content

Fix compat with extensionless scripts/* imports - #57718

Closed
huntie wants to merge 1 commit into
react:mainfrom
huntie:export-D113898792
Closed

Fix compat with extensionless scripts/* imports#57718
huntie wants to merge 1 commit into
react:mainfrom
huntie:export-D113898792

Conversation

@huntie

@huntie huntie commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary:
Context

Replaces #57709, which identified a real bug in 0.87 from the combination of:

$ 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'

Thanks @chrfalch for raising this!

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

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
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 28, 2026
@meta-codesync

meta-codesync Bot commented Jul 28, 2026

Copy link
Copy Markdown

@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D113898792.

@chrfalch chrfalch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@meta-codesync

meta-codesync Bot commented Jul 28, 2026

Copy link
Copy Markdown

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>
@huntie
huntie deleted the export-D113898792 branch July 28, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants