Open andrejpavlovic opened 1 day ago
It looks the issue is caused by this line which I assume is checking whether the path is absolute, and if not, prepends ./
to it. However the absolute check doesn't work as expected on Windows.
This patch worked for me, though I hope there is a more robust way to do this check - maybe path.isAbsolute
.
@expo+cli+0.21.7.patch
diff --git a/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js b/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
index a91ee15..ae7ec91 100644
--- a/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
+++ b/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
@@ -635,7 +635,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
serializerOutput: "static"
};
// https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87
- if (!opts.mainModuleName.startsWith("/")) {
+ if (!opts.mainModuleName.startsWith("/") && !/^[a-zA-Z]:\\/.test(opts.mainModuleName)) {
opts.mainModuleName = "./" + opts.mainModuleName;
}
const output = await this.metroLoadModuleContents(opts.mainModuleName, opts, extraOptions);
path.isAbsolute
fwiw
Minimal reproducible example
https://github.com/allboatsrise/expo-52-test
What platform(s) does this occur on?
Android
Where did you reproduce the issue?
in a development build
Summary
I'm getting
Error: Unable to resolve module
error when trying to runnpx expo run:android --variant release
on Windows on fresh install.Reproduce:
Result:
It looks like some sort of an issue building on Windows since the path seems to be prefixed with
./
Environment
Expo Doctor Diagnostics