cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
2020-05-17T09:31:15.066700Z

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

thheller 2020-05-17T09:43:15.067Z

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

thheller 2020-05-17T09:43:26.067400Z

might as well call it target webpack 😛

dnolen 2020-05-17T11:01:44.069400Z

@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

dominicm 2020-05-17T11:02:51.070400Z

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

dnolen 2020-05-17T11:03:38.070700Z

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

dnolen 2020-05-17T11:04:02.071200Z

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

dnolen 2020-05-17T11:16:10.075Z

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

dnolen 2020-05-17T11:18:07.076700Z

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

👍 1
dnolen 2020-05-17T11:18:19.077Z

the first time you build it won't exist

dnolen 2020-05-17T11:23:06.079100Z

@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

dnolen 2020-05-17T11:24:07.080100Z

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.

dnolen 2020-05-17T11:25:33.081600Z

@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.

dnolen 2020-05-17T11:25:57.082300Z

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

dnolen 2020-05-17T11:26:36.083200Z

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

dnolen 2020-05-17T11:27:24.083800Z

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

dnolen 2020-05-17T11:28:07.084600Z

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

👍 1
dominicm 2020-05-17T11:39:07.085600Z

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

dnolen 2020-05-17T11:41:05.086300Z

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

dominicm 2020-05-17T11:41:34.087100Z

@dnolen it's fine for optimizations advanced.

dominicm 2020-05-17T11:41:39.087300Z

But not for none

dnolen 2020-05-17T11:42:05.087700Z

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

dominicm 2020-05-17T11:47:13.087900Z

Okay, cool :)

dominicm 2020-05-17T12:06:27.088500Z

https://babeljs.io/docs/en/babel-plugin-transform-es3-member-expression-literals could we do this when hitting a reserved name for es3?

dominicm 2020-05-17T12:07:36.089100Z

Or do Google closure optimizations mess with that?

bhauman 2020-05-17T13:43:52.098100Z

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.

bhauman 2020-05-17T13:44:00.098400Z

Things to keep in mind:

bhauman 2020-05-17T13:44:35.099Z

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

bhauman 2020-05-17T13:45:51.100100Z

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

bhauman 2020-05-17T13:46:13.100700Z

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

bhauman 2020-05-17T13:46:55.101500Z

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

dominicm 2020-05-17T13:47:52.102900Z

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

bhauman 2020-05-17T13:48:17.103900Z

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

dominicm 2020-05-17T13:48:17.104Z

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

bhauman 2020-05-17T13:50:23.105500Z

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

bhauman 2020-05-17T13:51:46.106700Z

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

bhauman 2020-05-17T13:52:07.107100Z

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

bhauman 2020-05-17T13:53:00.108200Z

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

bhauman 2020-05-17T14:11:35.115600Z

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

dominicm 2020-05-17T18:54:51.116700Z

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?

dominicm 2020-05-17T18:58:59.116800Z

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

bhauman 2020-05-17T20:45:05.117200Z

you have to print standard error

thheller 2020-05-17T20:48:39.117600Z

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

bhauman 2020-05-17T20:58:39.117900Z

I was just about to say that 🙂

bhauman 2020-05-17T20:58:54.118200Z

but bottom line it prints to standard error

dominicm 2020-05-17T21:30:02.118300Z

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