drapanjanas/re-natal

RN 0.56.0 support

jeaye opened this issue · 4 comments

jeaye commented

Hey @drapanjanas. :)

I've been working on trying to get re-natal up to speed with RN 0.56.0 after an overzealous upgrading session. To start with, I've identified one issue with a quick fix.

  1. error: bundling failed: Error: Unable to resolve module 'figwheel-bridge'

    This is fixed by updating index.android.js to require('./figwheel-bridge') instead. So, we can just change

    fs.writeFileSync "index.#{platform}.js", "#{moduleMap}require('figwheel-bridge').withModules(modules).start('#{projName}','#{platform}','#{devHost[platform]}');"
    to do this.

Once that's out of the way, I start seeing Uncaught TypeError: goog.nodeGlobalRequire is not a function on startup. Interestingly, when searching for this issue, I see #128 come up, which is referenced by retro/graphql-builder#4. Looks like others have had this issue, but worked around it by just not using the library which caused it. In general, that's likely not a dependable solution.

I've hit a bit of a wall now. What do you see as the way forward?

RN: 0.56.0
re-natal: 0.9.0
CLJS: [org.clojure/clojurescript "1.10.238"]
Reagent: [reagent "0.8.1"]
Target: :nodejs

Also here are two vulnerabilities reported when not upgraded to 0.56.0:

$ npm audit
                                                                                
                       === npm audit security report ===                        
                                                                                
# Run  npm install react-native@0.56.0  to resolve 2 vulnerabilities
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ react-native                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ react-native > plist > xmlbuilder > lodash                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Denial of Service                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ ws                                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ react-native                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ react-native > react-devtools-core > ws                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/550                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


found 2 vulnerabilities (1 low, 1 high) in 34468 scanned packages
  run `npm audit fix` to fix 2 of them.

(Tried to run npm audit fix but my project didn't work afterwards.)

For what it's worth I just did a trial upgrade to RN 0.56.0...

Steps were:

  • Run react-native-git-upgrade & fix merge conflicts
  • Patch index.ios.js to require figwheel bridge with a relative path (e.g. require('./figwheel-bridge')...
  • Update babel-preset-react-native to "5.0.2" (surprised this wasn't done for me)
  • Update a few other deps for compatibility with RN 0.56.0
  • Problem with Metro bundler throwing File not found: target/ios/devtools/prefs.js.js errors (only when remote debugging... still seems to need a js.js patch)
  • Use fresh rn56 init to discover some different deps to update.

Conclusions: it can be made to work with hacks but wasn't able to stop the bundler throwing a lot of errors when remote debugging was enabled

I had to change figwheel to load the import scripts async with Chrome to get fighweel to work. I.e. setting this to false:

if (isChrome()) {

v0.11.1 works with latest React Native version