cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
2020-07-04T10:43:03.389200Z

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

2020-07-04T12:12:22.389600Z

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

👍 1
thheller 2020-07-04T13:25:02.390200Z

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

2020-07-04T13:30:29.393600Z

@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)

mfikes 2020-07-04T17:36:49.395800Z

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.)