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
Do you think it's possible to get this working in the browser? #3
Comments
Hello! I think this should work fine in a browser. I don't think there's anything specific to the native runtime that we're doing with this module. Yes that's right. You should be able to experiment with this directly using the Example App. |
This will probably work: const { Wormhole } = createWormhole({
global: {
require: (moduleId: string) => {
if (moduleId === 'react') {
return require('react');
+ } else if (moduleId === 'react-native' || moduleId === 'react-native-web') {
return require('react-native');
} else if (moduleId === 'react-native-webview') {
return require('react-native-webview);
}
return null;
},
},
verify: async () => true,
}); |
Sweeeet I'll try this right now. |
Don't get your hopes up. 😛 The thinking here was that Webpack should make the appropriate decision for us, so even though we're saying |
After some experimenting I got this working with the following setup and using if (moduleId === "react") {
return require("react");
} else if (moduleId === "react-native" || moduleId === "react-native-web") {
return require("react-native");
} else if (moduleId === "@babel/runtime/helpers/interopRequireDefault") {
return require("@babel/runtime/helpers/interopRequireDefault");
} |
I'm curious if you think it's possible to get this working with
react-native-web
as well as a mobile device.Would all I need to do is include
react-native-web
as a module in the wormhole and modify the babel output to support RNW?The text was updated successfully, but these errors were encountered: