inokawa / react-native-react-bridge

An easy way to integrate your React (or Preact/React Native Web) app into React Native app with WebView.
https://www.npmjs.com/package/react-native-react-bridge
MIT License
265 stars 21 forks source link

Crash after changing metro.config.js - > node_modules\expo-router\entry.js: traverse is not a function #126

Closed katche70 closed 6 months ago

katche70 commented 1 year ago

Describe the bug after changing metro.config.js to module.exports = { ...config, transformer: { ...config.transformer, babelTransformerPath: require.resolve( "react-native-react-bridge/lib/plugin" ), }, }; i can't start react app anymore: node_modules\expo-router\entry.js: traverse is not a function

To Reproduce Steps to reproduce the behavior.

Expected behavior A clear and concise description of what you expected to happen.

Platform:

Additional context Web Bundling failed 826ms error: node_modules\expo-router_error.js: traverse is not a function Web node_modules\expo-router/entry.js ░░░░░░░░░░░░░░░░ 0.0% (0/1) Metro error: node_modules\expo-router\entry.js: traverse is not a function

Call Stack MetroBundlerDevServer.getStaticResourcesAsync (node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js) process.processTicksAndRejections (node:internal/process/task_queues) async MetroBundlerDevServer.getStaticPageAsync (node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js) async (node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js) Web Bundling failed 10ms error: node_modules\expo-router\entry.js: traverse is not a function Web Bundling failed 9ms error: node_modules\expo-router\node\render.js: traverse is not a function Web Bundling failed 12ms error: node_modules\expo-router_error.js: traverse is not a function › Detected a change in babel.config.js. Restart the server to see the new results. You may need to clear the bundler cache with the --clear flag for your changes to take effect.

iabdulhannan commented 1 year ago

Facing the same issue!

iabdulhannan commented 1 year ago

Fix!

For me the error was occurring at: node_modules/react-native-react-bridge/lib/plugin/index.js

I modified this var traverse = require('@babel/traverse'); to var _traverse = require('@babel/traverse'); const traverse = _traverse.default;

and the error went away!

inokawa commented 1 year ago

Thanks! I've released a patch 0.11.1. Could you try it?

iabdulhannan commented 1 year ago

Hey! The patch 0.11.1 worked, the error is gone but now I'm facing the following:

ReferenceError: Property 'n' doesn't exist, js engine: hermes.

To reproduce it, just create an Expo project and follow the instructions on this package's Homepage to create a demo project.

accelerate-dm commented 1 year ago
Screenshot 2023-09-14 at 5 53 15 PM

I am also facing same issue with version 0.11.1.

edjiang commented 1 year ago

Having the same issue. Any ideas?

inokawa commented 1 year ago

0.11.2 is released. Thank you for your contribution!