cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
g7s 2019-09-24T07:52:39.048300Z

Hi! I wrote a library using Google Closure and I used the new goog.module instead of the old goog.provide/require, but unfortunately it doesn’t work with CLJS. I know that the code cljs emits uses goog.provide but here https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide#how-do-i-use-a-googmodule-from-a-traditional-closure-file is a method to require goog.module files in goog.provide ones which I think would be cool if cljs supported.

g7s 2019-09-24T07:55:49.049800Z

If one would like to take a stab at it are the recommendations here https://clojure.atlassian.net/browse/CLJS-1543 valid?

thheller 2019-09-24T07:59:42.050900Z

@g7s this would be a pretty big effort I think. CLJS lags the closure library pretty significantly and uses a rather old version where the debug loader doesn't support this I believe

g7s 2019-09-24T08:10:55.053Z

@thheller so you say that a first step would be to update the closure library that cljs uses..

g7s 2019-09-24T08:11:56.053900Z

I get that this would be a significant effort by itself

thheller 2019-09-24T08:12:28.054500Z

I'm not sure but I think so yes

thheller 2019-09-24T08:12:53.055Z

I think the version currently used only supports loading regular goog.provide/require files

thheller 2019-09-24T08:13:16.055600Z

versions after that added a optional transpile step support for modules (es6 or goog)

thheller 2019-09-24T08:13:27.055900Z

but depending on the goog.module style you use it might work with the old version

thheller 2019-09-24T08:13:40.056200Z

transit uses goog.module and works fine

thheller 2019-09-24T08:14:37.056500Z

ah no sorry. not goog.module, goog.scope

thheller 2019-09-24T08:15:22.057100Z

you can try shadow-cljs and see if goog.module works. I think it should.

g7s 2019-09-24T08:19:16.059Z

From my little experience trying to make it work, it seems that goog.scope works with current cljs. I will try with shadow or I will have to switch the library to the old style

thheller 2019-09-24T08:19:37.059400Z

there is some compatibility mode that should work

thheller 2019-09-24T08:20:03.060200Z

plain goog.module without scope requires compilation or a loader that does that

g7s 2019-09-24T08:22:51.060900Z

do you mean the goog.module.declareLegacyNamespace thing?

thheller 2019-09-24T08:23:24.061400Z

yes

g7s 2019-09-24T08:24:05.061800Z

thanks I will see what I can do for the moment