Skip to content

Conversation

@kitten
Copy link
Contributor

@kitten kitten commented Nov 20, 2025

Summary

Errors may be swallowed in require, which then cascades the error to await import. However, this may then trigger an error on Windows since absolute Windows paths cannot be passed to await import and need to be file URLs instead (C: or D: look like protocols to import otherwise)

We could also expose the error from require instead if the codes match a set of allowed (or not match a set of disallowed) error codes, but it's hard to get a comprehensive list for those without testing across all Node LTS versions.

Changelog: [Fix] Prevent absolute path error on await import() for Windows absolute paths

Test plan

This is admittedly a speculative fix, and I still need to test this, but I've only observed this in Expo CI for now.

@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 Nov 20, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 20, 2025
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Nov 21, 2025

@robhogan has imported this pull request. If you are a Meta employee, you can view this in D87629711.

kitten added a commit to expo/expo that referenced this pull request Dec 16, 2025
…`resolveConfig` loading (#41142)

# Why

Not too many relevant changes should be brought in by `metro@0.83.3`,
but the most important one we're looking for is:
facebook/metro@af3bcca

We're still seeing obfuscated errors on Windows. When `require` fails
`metro-config` falls back to `await import` but passes an absolute path
to it, which is invalid, see:
facebook/metro#1620

The typings changes are partially drive-by changes, but it's easier to
keep track of the config types now.

# How

- Upgrade to `@expo/metro@54.2.0`
- Ensure `getDefaultConfig` in `@expo/metro-config` returns exact types
- Bypass `loadConfig` implementation from Metro and only run
`resolveConfig`

# Test Plan

- CI

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
-->

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
kitten added a commit to expo/expo that referenced this pull request Dec 16, 2025
…`resolveConfig` loading (#41142)

Not too many relevant changes should be brought in by `metro@0.83.3`,
but the most important one we're looking for is:
facebook/metro@af3bcca

We're still seeing obfuscated errors on Windows. When `require` fails
`metro-config` falls back to `await import` but passes an absolute path
to it, which is invalid, see:
facebook/metro#1620

The typings changes are partially drive-by changes, but it's easier to
keep track of the config types now.

- Upgrade to `@expo/metro@54.2.0`
- Ensure `getDefaultConfig` in `@expo/metro-config` returns exact types
- Bypass `loadConfig` implementation from Metro and only run
`resolveConfig`

- CI

<!--
Please check the appropriate items below if they apply to your diff.
-->

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
aleqsio pushed a commit to expo/expo that referenced this pull request Dec 22, 2025
…`resolveConfig` loading (#41142)

# Why

Not too many relevant changes should be brought in by `metro@0.83.3`,
but the most important one we're looking for is:
facebook/metro@af3bcca

We're still seeing obfuscated errors on Windows. When `require` fails
`metro-config` falls back to `await import` but passes an absolute path
to it, which is invalid, see:
facebook/metro#1620

The typings changes are partially drive-by changes, but it's easier to
keep track of the config types now.

# How

- Upgrade to `@expo/metro@54.2.0`
- Ensure `getDefaultConfig` in `@expo/metro-config` returns exact types
- Bypass `loadConfig` implementation from Metro and only run
`resolveConfig`

# Test Plan

- CI

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
-->

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
@meta-codesync meta-codesync bot closed this in ef95470 Jan 2, 2026
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Jan 2, 2026

@robhogan merged this pull request in ef95470.

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 Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants