This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-19
Channels
- # announcements (3)
- # beginners (29)
- # biff (10)
- # calva (33)
- # cider (1)
- # clara (8)
- # clerk (10)
- # clj-kondo (6)
- # cljs-dev (5)
- # clojure (40)
- # clojure-dev (3)
- # clojure-europe (43)
- # clojure-gamedev (1)
- # clojure-nl (1)
- # clojure-norway (19)
- # clojure-uk (2)
- # clr (3)
- # cursive (12)
- # datomic (4)
- # devcards (3)
- # gratitude (3)
- # honeysql (13)
- # hoplon (25)
- # humbleui (3)
- # hyperfiddle (38)
- # malli (26)
- # pathom (38)
- # practicalli (2)
- # rdf (6)
- # reagent (8)
- # shadow-cljs (13)
- # xtdb (1)
Hello, I'm pretty confused about using JS files in shadow-cljs projects.
I have a file like src/js/my_project/model_viewer.js
which imports BufferGeometry:
import { BufferGeometry } from 'three/build/three.module';
const buff = new BufferGeometry();
I get an error saying BufferGeometry$$module$node_modules$three$build$three_module
doesn't exist. But it does actually exist in the compiled module$node_modules$three$build$three_module.js
compiled source it's just not loaded I guess. Is there a way to get this to work?It does work if I do it this way:
import Three from 'three'; // legacy three module
const buff = new Three.BufferGeometry();
But this is not how almost any existing addon scripts import/use Three.js classes, making it impossible to use them.the direct import of JS files has always been somewhat unreliable. we are mercy of how the closure compiler rewrites the code, and there are certain things that don't work very reliably unfortunately
hm, okay thanks I'll give that a shot. Feels like I'm missing something dumb.
nah its just not a heavily used feature. so there are issues. if you want to make a repro I can take a look. sometimes its an easy fix, sometimes not so much
Sure, I just threw up a repo with a minimal example: https://github.com/SovereignShop/shadow-npm-three-example
... It works now. I told you it was something dumb!
thanks for the help