This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-24
Channels
- # aleph (1)
- # babashka (2)
- # beginners (25)
- # calva (5)
- # cider (8)
- # cljdoc (4)
- # clojure (81)
- # clojure-europe (41)
- # clojure-spec (11)
- # clojurescript (7)
- # conjure (1)
- # data-science (1)
- # datomic (25)
- # defnpodcast (3)
- # events (2)
- # figwheel-main (8)
- # fulcro (5)
- # helix (4)
- # hugsql (1)
- # java (2)
- # off-topic (35)
- # onyx (18)
- # pathom (8)
- # rdf (5)
- # re-frame (9)
- # reagent (3)
- # reitit (1)
- # shadow-cljs (39)
- # tools-deps (53)
- # xtdb (23)
how is wasm support nowadays? I think I will try to get https://github.com/antelle/argon2-browser working. I installed it from npm and tried requiring it in cljs, but it looks like something can't even read the wasm magic header: {:line 1, :column 0, :message "Character '\0' (U+0000) is not a valid identifier start char"}
@kevin842 bundling wasm is not supported. you can still use wasm, just not bundle it
yeah, but I figured I would try to get it working like in https://github.com/thheller/wasm-pack-cljs
well, reading the generated JS doesn't seem that bad, being only ~600 lines prettified, but I wish there were better error messages to even see what's going on
https://unpkg.com/browse/[email protected]/lib/argon2.js if thats it all the import
stuff needs to go
how so? some of the code in there is for node.js, so maybe that's why.. but I am having trouble even figuring out what to look for, is there a resource?
what doesn't work is any kind of JS that expects the bundler to provide the .wasm file
if there is a variant that uses fetch or xhr to load the .wasm file then this variant should be used
and you just copy the .wasm file somewhere and provide the path (assuming thats possible)
unfortunately the emscripten generated code is quite terrible and contains a lot of useless loading code
that's unfortunate.. you think the rust wasm toolchain is friendlier than emscripten?
its been a while since I looked at it though and it was completely different the time I checked before that
this one seems to work out of the box: https://github.com/Daninet/hash-wasm
So I’m trying to upgrade shadow-cljs from 2.8 to 2.11.5, and I’m having some problems. Specifically, my build compiles without errors, but my ‘core’ ns doesn’t get loaded when I open my app in a browser. Instead, I see the following error in the browser:
react_devtools_backend.js:2450 Failed to load foo/core.cljs SyntaxError: Unexpected identifier
at eval (<anonymous>)
at Object.goog.globalEval (base.js:577)
at Object.shadow$cljs$devtools$client$browser$script_eval [as script_eval] (browser.cljs:23)
at Object.shadow$cljs$devtools$client$browser$do_js_load [as do_js_load] (browser.cljs:35)
at eval (browser.cljs:56)
at eval (env.cljs:232)
at Object.shadow$cljs$devtools$client$env$do_js_reload_STAR_ [as do_js_reload_STAR_] (env.cljs:204)
at Function.eval [as cljs$core$IFn$_invoke$arity$4] (env.cljs:240)
at Object.shadow$cljs$devtools$client$browser$do_js_reload [as do_js_reload] (browser.cljs:48)
at eval (browser.cljs:92)
Any idea what might be causing this, or how I can fix it?Okay I figured it out. I had a function marked as ^:export
, and it started working as soon as I removed that keyword. Has ^:export
been deprecated, or could there be something else going on?
…I assume that ^:export
is intended to work, considering that it’s mentioned in the documentation: https://shadow-cljs.github.io/docs/UsersGuide.html#_working_with_optimizations
Alright, good to know.
Any idea why it would break my code?
okay 🙂
I can't get shadow-cljs to bundle an npm library with a node-script target. I've installed the lib via npm, its in my packages.json, also added a deps.cljs:
{:npm-deps {"xmlhttprequest" "1.8.0"}}
it's required like this:
["xmlhttprequest" :refer [XMLHttpRequest]]
no complaints on compilation but get
Error: Cannot find module 'xmlhttprequest'
at runtime. What am i missing?@afhammad node builds don't bundle their dependencies by default since node can just load them from node_modules
directly. so either just include the node_modules
whereever you are running it or post process the file with something like https://github.com/vercel/ncc