The solution is simple, but temporary...
Note that if you run an npm install or a yarn install you need to change the code again!
So, how can we run this automatically?
Permanent Solution
To do this "automagically" after installing your node modules, you can use patch-package.
- Fix the
metro-configfile, solving the error:
The file appears in \node_modules\metro-config\src\defaults\blacklist.js.
Edit from:
var sharedBlacklist = [ /node_modules[/\\]react[/\\]dist[/\\].*/, /website\/node_modules\/.*/, /heapCapture\/bundle\.js/, /.*\/__tests__\/.*/ ]; To:
var sharedBlacklist = [ /node_modules[\/\\]react[\/\\]dist[\/\\].*/, /website\/node_modules\/.*/, /heapCapture\/bundle\.js/, /.*\/__tests__\/.*/ ]; - Then, generate a permanent patch file:
npx patch-package metro-config
- In your
package.jsontrigger the patch:
"scripts": { + "postinstall": "npx patch-package" } All done! Now this patch will be made at every npm install / yarn install.
Thanks to https://github.com/ds300/patch-package