This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-09
Channels
- # announcements (1)
- # babashka (14)
- # calva (8)
- # chlorine-clover (3)
- # clerk (6)
- # clj-kondo (27)
- # cljdoc (20)
- # clojars (6)
- # clojure (53)
- # clojure-denver (8)
- # clojure-europe (17)
- # clojure-nl (1)
- # clojure-norway (270)
- # clojure-uk (5)
- # clojurescript (35)
- # community-development (7)
- # cursive (12)
- # datalevin (3)
- # datomic (26)
- # etaoin (23)
- # exercism (1)
- # hyperfiddle (3)
- # java (14)
- # nrepl (2)
- # off-topic (12)
- # pathom (3)
- # portal (44)
- # practicalli (2)
- # reagent (7)
- # releases (1)
- # shadow-cljs (13)
- # timbre (3)
- # xtdb (4)
Next challenge… https://github.com/djblue/portal/blob/master/src/portal/ui/load.cljs#L44 seems to be having trouble with a dependency where I’ve explicitly specified the ES6 module version of a file: https://github.com/mentat-collective/MathBox.cljs/blob/main/src/mathbox/core.cljs#L5
@djblue I was also seeing a failure requiring "threestrap"
, even if I specified "type": "module"
in package.json: https://github.com/unconed/threestrap/blob/master/package.json#L9
because "main"
was pointing to a module, not to a built bundle
I fixed that error by manually (in node_modules, for testing) modifying the package.json of https://github.com/unconed/threestrap, https://github.com/unconed/shadergraph and https://github.com/unconed/mathbox to point to built bundles, but three.js is explicitly deprecating the non-module versions of all of their stuff soon
any thoughts on how to handle this case?
looks like it might be possible to transpile it at runtime
or server-side via load I guess
The killer is the first link, where I import in mathbox.cljs the module version of OrbitControls.js (since that’s what three.js wants, I don’t know if they still publish a non-module version?)
And they will stop in a few versions for the main “three” dependency
I didn't think the npm support would run into this issue so quickly, why does js have to be this way lol
I am not sure, I am similarly flummoxed by the JS world here
I think the worst part about this is that esmodules have such varied / complex syntax 😭
I wish they had just used the exist language syntax of function calls, then mocking an implementation would be trivial
I think https://stackoverflow.com/questions/57121467/import-a-module-from-string-variable might be part of a solution
JSXGraph.cljs works now, just needs styling… @djblue mathbox is the only one left to fall 🙂

@djblue ugh, unfortunately it is because threejs removed all of the non-module controls instances. https://github.com/mrdoob/three.js/blob/dev/examples/jsm/controls/OrbitControls.js
so I COULD transpile this one file and then we’d be okay, if it’s going to be a nightmare
but that is the only blocker so it’s not crazy
@djblue and then leva is working great… at some point I’ll need to bump portal to catch that npm fix you applied
Every other library in this series works now @djblue !
amazing!
a little late but, is it possible to do this for d3-force
? I'd like to require that but it's an es module as well and seems to not be on the commonjs path
not sure!
I tested d3-force with the Babel branch and it does load, but I'm still not sure about the cost benefit here :thinking_face:
The alternative would be to get the browser to load the esm module, which should be natively supported for the most part. I haven't played around with that yet.
is there any reason that the intellij plugin would behave differently? I assume it's not built on electron but I haven't checked so it may be the same
Sorry, the Babel branch hasn't been released yet if you are using a released version of portal.
For the most part, the intellij plugin should be acting as a browser window for the portal app that's being hosted by the REPL process. I think people have experienced some issues around some of the native inputs acting a little weird, but the client code is identical to running it in any other browser client.
I just built the jar and gave the ESM version a spin - works great! I honestly am not familiar enough with the JS landscape to know if there is another better solution than this, but I can confirm that the PR branch is very useful 🙂
@U5P29DSUS actually, it looks like d3-force
exports a umd module which is consumable without esm support. Should "just work" after https://github.com/djblue/portal/commit/86b2b61e9edc7c599726701f1ee75a8601c4373e is released.
Ok, should be available with the https://github.com/djblue/portal/releases/tag/0.48.0 release.