drapanjanas / re-natal

Bootstrap ClojureScript React Native apps
MIT License
1.22k stars 100 forks source link

Accommodate new Closure Library dependency loading strategy #179

Open mfikes opened 6 years ago

mfikes commented 6 years ago

Closure Library has made some internal changes which break clients using internal API. ClosureScript's shipping REPLs use private API, and updates are being made via CLJS-2702.

One such private API change is the removal of goog.writeScriptTag_ (which is used in re-natal here).

If you build a version of ClosureScript that uses the latest Closure Library, and then try to use re-natal with that version, you will see it log "Cannot use default debug loader outside of HTML documents", and if you dismiss this, you will see that it indicates it is still waiting for Figwheel to load files. If you add this to the bottom of shimBaseGoog in figwheel-bridge.js:

goog.global.CLOSURE_IMPORT_SCRIPT = goog.writeScriptTag_;

then you can dismiss the log an the app will launch, but Figwheel will not connect. This change is motivated by a similar change in the patch in CLJS-2702 for the shipping browser REPL, but it is evidently insufficient to get things fully working in re-natal.

So, even though the complete solution is not known yet, I'm logging this ticket so we can gather relevant information so that re-natal has a solution ready if / when the new Closure Library starts being shipped with ClojureScript. If it proves difficult to find a solution, then one expected workaround would be to have re-natal clients override the Closure Library dependency so that the older one is used. (ClojureScript's revisions are being done in a way that can accommodate both the older and newer ClosureLibrary code, conditionally switching at runtime; perhaps re-natal can do the same to maximize flexibility.)

Note: To build ClojureScript with the new Closure Library involves running script/closure-library-release/closure-library-release.sh in that repo, updating project.clj and other files to reflect the newly build version (see this commit as an example), running script/bootstrap and then manually copying the google-closure-library-0.0-20180503-da9add34.jar and google-closure-library-third-party-0.0-20180503-da9add34.jar files into lib (replacing the version numbers as appropriate) and then doing script/build.

mfikes commented 6 years ago

CLJS-2702 has now landed https://github.com/clojure/clojurescript/commit/b31a9a9baec5401813e0f994c78a6f1c6db67a3c

This makes it easier to build a version of ClojureScript that uses the latest Closure Library (as detailed in the Note above).

7tupel commented 2 years ago

It has been a while since the issue was created but I believe it still poses a problem. At least I run into the same error with re-natal and a fork of it that I created for proper react-native >0.59 versions. Running with Clojure 1.10.3 and Clojurescript 1.11.4

Did you make any progress except using an older Clojure and Clojurescript version?