Fork me on GitHub
#cljs-dev
<
2020-05-17
>
Roman Liutikov09:05:15

Funny thing, Rust's tool for building into WASM also has target bundler https://rustwasm.github.io/docs/wasm-bindgen/reference/deployment.html#bundlers

thheller09:05:15

> Currently the only known bundler known to be fully compatible with wasm-bindgen is webpack.

thheller09:05:26

might as well call it target webpack 😛

dnolen11:05:44

@dominicm sorry mies is no longer the bar - using ClojureScript directly - it used to be that wasn't that practical but with cljs.cli not really true anymore. Are you calling cljs.closure/build ? If so not really recommended anymore cljs.build.api/build

dominicm11:05:51

@dnolen np, bit more involved to get that set up. I'm using cljs.build.api/build

dnolen11:05:38

re: the thing you're talking about is known, a historical ugliness

dnolen11:05:02

and a refusal to break the old way - pretty sure if you can pass nil for 1st arg if you don't care

dnolen11:05:10

re: optimizing :bundle-cmd I don't really like that idea so much, but mostly because I think the class of things you might want to customize is larger than this particularly issue. Also any optimization here is bound to be a bit ugly. :bundle-cmd can be arbitrary

dnolen11:05:07

so why not a command that first checks if npm_deps.js is equal to npm_deps.last.js runs webpack if they're different, copies npm_deps.js to npm_deps.last.js

👍 4
dnolen11:05:19

the first time you build it won't exist

dnolen11:05:06

@darwin that Blender / CLJS approach seems like a lot of effort - I don't see the advantage over Client/REPL strategy - with the later you can definitely have something working in a couple of weeks - and something great in a couple of months since you just reuse everything already in ClojureScript

dnolen11:05:07

since you're embedding anyway you have a lot of control you don't have in say React Native wrt. sync file loading for dev etc.

dnolen11:05:33

@roman01la I think the important thing here if alternative targets are going to succeed is to stop thinking about it as a giant project. In fact best to start with a toy - ClojureScript was a toy too at one point.

dnolen11:05:57

I would make a project that just attempts to generate Dart from ClojureScript - it doesn't need to do everything

dnolen11:05:36

unconcerned with anything except generating some simple source from s-exprs

dnolen11:05:24

and everytime you hit a small hitch that's a discussion / JIRA ticket

dnolen11:05:07

if this is done as small steps over many months eventually all those little problems go away - and they go away for everyone - not just Dart

👍 4
dominicm11:05:07

@dnolen the single arity version passes nil as the first argument, and that's what is broken.

dnolen11:05:05

@dominicm hrm I thought nil could be passed as the first w/o issue

dominicm11:05:34

@dnolen it's fine for optimizations advanced.

dominicm11:05:39

But not for none

dnolen11:05:05

ok file an issue, no need to minimize since it's pretty clear

dominicm11:05:13

Okay, cool :)

dominicm12:05:36

Or do Google closure optimizations mess with that?

bhauman13:05:52

re: optimizing :bundle-cmd while folks can roll there own here, a lot of effort has gone into making incremental builds fast. The bundle target will be the default target at some point sooner or later and it would be a shame for everyones incremental build times to suffer behind a blunt approach.

bhauman13:05:00

Things to keep in mind:

bhauman13:05:35

re-bundles only take affect when one reloads their app from scratch

bhauman13:05:51

one needn’t use or rely on :bundle-cmd and can simply call their bundler from the command line whenever they want

bhauman13:05:13

one can use the watch option of their bundler to recompile on change

bhauman13:05:55

one sticky point is the initial bundling that we need in order to launch the application, as files the bundler needs don’t exist yet

dominicm13:05:52

I haven't actually seen a bundler without watch support yet. Maybe that's the way to go.

bhauman13:05:17

its just the initial build that’s kind of a bummer

dominicm13:05:17

If there was a bundle-fn you could use process builder to set that up.

bhauman13:05:23

you’re saying that you want an after-initial-build-hook kindof a thing?

bhauman13:05:46

yeah it seems to me bundling once at the beginning solves most of these problems

bhauman13:05:07

if you want to watch, start your bundler with a watcher

bhauman13:05:00

or if you make changes outside the scope of cljs, you can call your bundler manually

bhauman14:05:35

oh it should be mentioned here that this is all said in the context of in process incremental builds and the responsiveness of hot-reloading

dominicm18:05:51

What's the best way to run a repl in the project & test building against code? Or - what's your dev setup for the cljs codebase?

dominicm18:05:59

Also, printlns are really not helpful eh :) They seem to end up in the output code..

bhauman20:05:05

you have to print standard error

thheller20:05:39

there is a cljs.util/debug-prn (not sure on the namespace but I think thats right)

bhauman20:05:39

I was just about to say that 🙂

bhauman20:05:54

but bottom line it prints to standard error

dominicm21:05:02

Quite fun hacking on cljs stuff. Tricky, but fun :) all data-y.