-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crash at expo metro build #15
Comments
Similar issue to #14 |
Got any quick hint at how to hack around this for now? |
If you're using the new expo router did you try to disable SRR? On app.json switch web output to single. |
@8BallBomBom sorry, when this major update is roughly expected? |
Here is the patch we use: diff --git a/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js b/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js
index 7d10049..5b823e6 100644
--- a/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js
+++ b/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js
@@ -1,5 +1,7 @@
import RTCView from './RTCView';
+if (typeof window !== "undefined") {
+
window.MediaStream.prototype.release = function release() {
this.getTracks().forEach((track) => track.stop());
};
@@ -8,6 +10,8 @@ window.MediaStreamTrack.prototype._switchCamera = function _switchCamera() {
console.warn('_switchCamera is not implemented on web.');
};
+}
+
const {
RTCPeerConnection,
RTCIceCandidate,
@@ -18,13 +22,15 @@ const {
RTCErrorEvent,
MediaStream,
MediaStreamTrack,
-} = window;
+} = typeof window !== "undefined" ? window : {};
-const { mediaDevices, permissions } = navigator;
+const { mediaDevices, permissions } = typeof window !== "undefined" ? navigator : {};
function registerGlobals() {
- window.mediaDevices = navigator.mediaDevices;
- window.permissions = navigator.permissions;
+ if (typeof window !== "undefined") {
+ window.mediaDevices = navigator.mediaDevices;
+ window.permissions = navigator.permissions;
+ }
}
export {
|
Currently focused on the New Arch update for the main repo. Will need to look into this before deciding the best course of action 🤔 |
running:
npx expo export -p web
as described on https://docs.expo.dev/distribution/publishing-websites/
╰─>$ npx expo export -p web
Static rendering is enabled. Learn more
Starting Metro Bundler
λ Bundled 6747ms (node_modules/expo-router/node/render.js)
Web Bundled 6871ms (node_modules/expo-router/entry.js)
Metro error: window is not defined
1 | import RTCView from './RTCView';
2 |
Call Stack
factory (node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js:3)
loadModuleImplementation (node_modules/metro-runtime/src/polyfills/require.js:342:5)
guardedLoadModule (node_modules/metro-runtime/src/polyfills/require.js:240:12)
r (node_modules/metro-runtime/src/polyfills/require.js:127:7)
factory (node_modules/react-native-webrtc-web-shim/index.js:1)
loadModuleImplementation (node_modules/metro-runtime/src/polyfills/require.js:342:5)
guardedLoadModule (node_modules/metro-runtime/src/polyfills/require.js:240:12)
r (node_modules/metro-runtime/src/polyfills/require.js:127:7)
factory (app/calls/[id].js:8)
h (node_modules/metro-runtime/src/polyfills/require.js:342:5)
The text was updated successfully, but these errors were encountered: