Fork me on GitHub
#cljs-dev
<
2020-07-04
>
henryw37410:07:03

Hi. I am trying to load a js file from the classpath with cljs, like this:

goog.declareModuleId('jstest.es6demo');
...
export {Foo}
but I see that clojurescript's grepping doesn't include one for declareModuleId https://github.com/clojure/clojurescript/blob/a19f8e04dc0971f13316a8dd584156e2ffb67b96/src/main/clojure/cljs/js_deps.cljc#L119 I'm planning to have a go changing cljs compiler locally to see if adding a new regex gets the compile working, but anyone knows why that wouldn't work etc please let me know. FYI I have a demo repo showing compiling this with Closure directly and attempt at using it from cljs https://github.com/henryw374/cljs-using-non-foreign-es6

henryw37412:07:22

I have now got the example in the demo repo compiling, having added this commit to the compiler: https://github.com/henryw374/clojurescript/commit/745fe924a43f426a4eb86f6b9df04fc463320b27

👍 3
thheller13:07:02

@henryw374 why don't you just use goog.module? why does it have to be es6?

henryw37413:07:29

@thheller I've got some existing es6 code that I want to get the full Closure advanced compilation treatment (and I have tested that Closure dead code elim works on it by compiling with Closure directly). I can modify the es6 files, but want to change as little as possible. So it looks like just prepending goog.declareModuleId will suffice ... with small cljs compiler change (see my reply to my prev. message)

mfikes17:07:49

Revision to add self-parity tests are in CLJS-3262, but it also looks like we need to in general sort out how to make things fail in GitHub actions if either compilation fails or an actual unit test fails. (This doesn't appear to be specific to self-parity.)