I think I might've found a bug in either GCC or shadow-cljs, don't know how to proceed efficiently.
Trying to use https://github.com/opensheetmusicdisplay/opensheetmusicdisplay.
Added the simplest (:require ["opensheetmusicdisplay" :as osmd]), got shouted at in the JS console:
Failed to load node_modules/opensheetmusicdisplay/build/opensheetmusicdisplay.min.js SyntaxError: Identifier 't' has already been declared (at module$node_modules$opensheetmusicdisplay$build$opensheetmusicdisplay_min.js:27946:96)
at eval (<anonymous>)
at goog.globalEval (main.js:455:11)
The offending location has this:
const b = {path:{x:!0, y:!0, width:!0, height:!0}, rect:{}, text:{width:!0, height:!0}}, t = {"font-family":!0, "font-weight":!0, "font-style":!0, "font-size":!0};
t is probably defined somewhere above, got lost scrolling.
However, if I find the same location in node_modules/opensheetmusicdisplay/build/opensheetmusicdisplay.min.js manually, it has this:
const b={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const t={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};s.Merge(b.rect,t),s.Merge(b.path,t)}
Notice the extra {...} around const t=....
No clue what could've removed the surrounding {...} while building.
Tried reproducing with a JS file that's a part of the project - braces remained intact.
Tried creating a small JS file inside the same NPM module - same thing, braces remained intact.
So, so far it happens only with opensheetmusicdisplay.min.js and I don't know why.yeah gcc is something a bit confused about variable scoping
you could try the latest gcc and see if it still happens. requires a bit manual extra work though since the current cljs release is not compatible
That actually worked!
Or at least it seems so.
Just something I noticed in passing in your code:
;; (0,window.require)("react") // FIXME: why the 0,?
Seems it's because RescopeGlobalSymbols is generic and doesn't care that it's require, and it rewrites all f() into (0, NS.f)() to preserve how this works.