From c38327a1dd3d264f2e9d86bdd36a35abd572988d Mon Sep 17 00:00:00 2001 From: Lucas Wiener Date: Mon, 24 Sep 2018 13:45:37 +0200 Subject: [PATCH] Fixes for ReactNative 0.57 --- re-natal.coffee | 2 +- resources/figwheel-bridge.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/re-natal.coffee b/re-natal.coffee index fcdf672..e478e1c 100644 --- a/re-natal.coffee +++ b/re-natal.coffee @@ -768,7 +768,7 @@ generateDevScripts = () -> for platform in platforms moduleMap = generateRequireModulesCode(platformModulesAndImages(config, platform)) - fs.writeFileSync "index.#{platform}.js", "#{moduleMap}require('figwheel-bridge').withModules(modules).start('#{projName}','#{platform}','#{devHost[platform]}');" + fs.writeFileSync "index.#{platform}.js", "#{moduleMap}require('./figwheel-bridge').withModules(modules).start('#{projName}','#{platform}','#{devHost[platform]}');" log "index.#{platform}.js was regenerated" updateIosRCTWebSocketExecutor(devHost.ios) diff --git a/resources/figwheel-bridge.js b/resources/figwheel-bridge.js index 32d302e..269ac6e 100644 --- a/resources/figwheel-bridge.js +++ b/resources/figwheel-bridge.js @@ -152,15 +152,17 @@ function importJs(src, success, error) { } function interceptRequire() { - var oldRequire = window.require; + var oldRequire = window.__r; console.info("Shimming require"); - window.require = function (id) { + function newRequire (id) { console.info("Requiring: " + id); if (externalModules[id]) { return externalModules[id]; } return oldRequire(id); - }; + } + window.require = newRequire; + window.__r = newRequire; } function serverBaseUrl(host) {