From 5fc093640018b6564ffca50143300aad767a04e5 Mon Sep 17 00:00:00 2001 From: Adi-Marian Mutu <39502043+AdiMarianMutu@users.noreply.github.com> Date: Tue, 24 Feb 2026 10:30:10 +0200 Subject: [PATCH] fix(expo): `expo-web-browser` is not installed as a dependency (#7752) Co-authored-by: Alex Yang --- packages/expo/src/client.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/expo/src/client.ts b/packages/expo/src/client.ts index aaf9f29f89..09bcaba3c6 100644 --- a/packages/expo/src/client.ts +++ b/packages/expo/src/client.ts @@ -360,18 +360,22 @@ export const expoClient = (opts: ExpoClientOptions) => { undefined; try { Browser = await import("expo-web-browser"); - } catch (error) { - throw new Error( - '"expo-web-browser" is not installed as a dependency!', - { - cause: error, - }, - ); + } catch { + try { + Browser = require("expo-web-browser"); + } catch (error) { + throw new Error( + '"expo-web-browser" is not installed as a dependency!', + { + cause: error, + }, + ); + } } if (Platform.OS === "android") { try { - Browser.dismissAuthSession(); + Browser!.dismissAuthSession(); } catch {} } @@ -387,7 +391,7 @@ export const expoClient = (opts: ExpoClientOptions) => { params.append("oauthState", oauthStateValue); } const proxyURL = `${context.request.baseURL}/expo-authorization-proxy?${params.toString()}`; - const result = await Browser.openAuthSessionAsync( + const result = await Browser!.openAuthSessionAsync( proxyURL, to, opts?.webBrowserOptions,