Fork me on GitHub
#cljs-dev
<
2019-09-24
>
g7s07:09:39

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.

g7s07:09:49

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

thheller07:09:42

@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

g7s08:09:55

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

g7s08:09:56

I get that this would be a significant effort by itself

thheller08:09:28

I'm not sure but I think so yes

thheller08:09:53

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

thheller08:09:16

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

thheller08:09:27

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

thheller08:09:40

transit uses goog.module and works fine

thheller08:09:37

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

thheller08:09:22

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

g7s08:09:16

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

thheller08:09:37

there is some compatibility mode that should work

thheller08:09:03

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

g7s08:09:51

do you mean the goog.module.declareLegacyNamespace thing?

g7s08:09:05

thanks I will see what I can do for the moment