Fork me on GitHub
#shadow-cljs
<
2023-09-05
>
pmooser08:09:50

Is there any way to build a :node-script which uses a library that is wasm ?

thheller08:09:39

:node-script by default doesn't bundle any dependencies and lets node load them at runtime. so yes, this should work fine.

pmooser09:09:25

That's great news, thank you. I'm not quite at the point of trying it yet, but I'm optimistic.

pmooser15:09:07

I'm trying to use a wasm library (again) via shadow-cljs and an external bundler. I had this working before with quite a lot of help from @thheller -- and the asynchronously loaded module basically shows up as a promise, which we subsequently accessed with js-await ... Now I have a different kind of import I want to do, and I'm wondering how to do that.

pmooser15:09:23

Previously, my argument to require was just like this:

["@automerge/automerge" :as am-async]

pmooser15:09:44

Now I want to translate this kind of import statement:

import { next } from "@automerge/automerge";

pmooser15:09:33

The shadow-cljs docs say that would be like:

(require ["@automerge/automerge" :refer (next)])
But I suspect that isn't correct anymore due to the async module loading and promise stuff.

pmooser15:09:37

Any idea how I can do this ?

pmooser15:09:54

It looks like if I take the module mod that comes into js-await, I can access (.-next mod) and maybe that's it?

pmooser15:09:08

Yes, I believe that is working.

MegaMatt15:09:56

is it possible to have compiler specific options for a module? One of my modules doesn’t seem to like advanced optimization and it is very tiny anyway so I want to turn it to simple for that module only.

thheller15:09:55

no that is not possible

MegaMatt15:09:14

okay. thank you.