Skip to content

Commit

Permalink
fix(cli): resolve main module name by real filepath for `eas build --…
Browse files Browse the repository at this point in the history
…local` (#30340)

# Why

Should fix #30295
Should fix expo/eas-cli#2449

# How

- `eas build --local` uses a temporary file path, which get mixed with
`/private/var` and `/var`
- One is a symlink, which causes issues in Metro (especially since we
use `path.relative` quite a lot)
- Due to `path.relative`, it tries to resolve on
`../../../../../../../../../var` paths, instead of `/var` instead of the
real path `/private/var` on Mac.

# Test Plan

See #30295

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

Co-authored-by: Expo Bot <[email protected]>
  • Loading branch information
2 people authored and alanjhughes committed Jul 15, 2024
1 parent c116df2 commit 5abcb06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/@expo/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Resolve module specifiers to posix paths for Metro. ([#29696](https://github.com/expo/expo/pull/29696) by [@byCedric](https://github.com/byCedric))
- Ensure Metro dev server closes fully when clients are connected. ([#30067](https://github.com/expo/expo/pull/30067) by [@byCedric](https://github.com/byCedric))
- Fix app crashing when hitting debugger breakpoint through VSCode. ([#30287](https://github.com/expo/expo/pull/30287) by [@byCedric](https://github.com/byCedric))
- Resolve real locations of file paths when using `eas build --local`. ([#30340](https://github.com/expo/expo/pull/30340) by [@byCedric](https://github.com/byCedric))

### 💡 Others

Expand Down
2 changes: 1 addition & 1 deletion packages/@expo/cli/src/export/embed/exportEmbedAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export async function exportEmbedBundleAndAssetsAsync(
const bundles = await devServer.legacySinglePageExportBundleAsync(
{
splitChunks: false,
mainModuleName: options.entryFile,
mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),
platform: options.platform,
minify: options.minify,
mode: options.dev ? 'development' : 'production',
Expand Down

0 comments on commit 5abcb06

Please sign in to comment.