[CLJS-2763] cljs.core/resolve fails under :advanced compilation (regression) Created: 01/Jun/18 Updated: 06/Jun/18 Resolved: 06/Jun/18
|Reporter:||Pieter du Toit||Assignee:||Unassigned|
The macro cljs.core/resolve does not produce sufficient information to invoke (when using :advanced compilation) a function across module boundaries under certain conditions.
With :advanced compilation, the attempt of module A to invoke the function in module B after load then fails at runtime. The issue occurs when using 1.10.238, but does not occur when using 1.9.946.
A minimal repro is provided below:
The repro can be compiled by running clj -m cljs.main -co build.edn -c
|Comment by David Nolen [ 01/Jun/18 1:24 PM ]|
|Comment by Pieter du Toit [ 01/Jun/18 11:57 PM ]|
I have narrowed the minimal repro down to React v16 being specified as a foreign lib dependency in the target module. Under :advanced compilation and with React v16, the module's compiled js function definitions are not available after the module is loaded. The attempt by the calling module to then invoke the function in the target module fails with the error "Uncaught TypeError: Cannot read property '$cljs$core$IFn$_invoke$arity$0$' of null" .
A minimal repro that produces the error is provided below:
It can be launched by running clj build.clj , once it is launched, observe the error message in the browser's console.
React v16's use of a global scope "use strict" directive seems to be the cause. The minimal repro can also be narrowed down further by removing the React dependency and prepending "use strict"; to out/b.js after compilation.
|Comment by David Nolen [ 06/Jun/18 3:53 PM ]|