Ok, so what happens is that I import the dat.GUI w...
# javascript
l
Ok, so what happens is that I import the dat.GUI wrapper in one example -> I need to import dat.GUI.js for all my examples in the project even if I dont use the library. Becouse dat.GUI gets referenced in the single output file examples.js
b
what do you meen by “I need”?
l
Without it, it crashes
wont run
If I were able to generate one output file for each example, I would not have a problem
using modules perhaps?
b
could you please send me links to the example where it’s used
where it’s not used
do you write something like “require” explicitly?
l
kotlin generated code or kotlin source?
no
b
source
so that do you mean by “import dat.GUI.js”?
l
import info.laht.threekt.external.libs.datgui.dat
is causing the issue, becouse it gets referenced in the generated .js
b
w/o any usage?
just import?
l
the class gets instantiated
here I use dat.GUI in one of the examples
these three examples gets generated as a single output file "examples.js"
b
ok, as I see it’s single gradle project
l
yes
b
so you will get one .js file
l
indeed
b
where at the start we asserts that all required libraries available at runtime
l
yes, which throws en error if I dont include it
b
it’s the reason why dat.GUI required for examples
l
so, my question is how can I make it more relaxed / generate multiple files
b
maybe you wanted to load dependencies lazily?
l
yes
feel free to vote or star to get notification about updates
unfortunately, right now it’s imposible
l
ok, thanks for the assistance anyhow 🙂
b
welcome
l
was nice with the link
p
It would probably involve some manual hacking around. In particular you may want to use require as a (perhaps synchronous) lookup function. Basically having the wrapper available doesn't actually imply in all cases that the underlying library is available. You just can't rely on
@JsModule
for automatic dependency management.