cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
dominicm 2020-04-26T08:36:02.129600Z

I'm using the new bundle option with the cli -w src and getting:

Change detected, recompiling ...
java.lang.AssertionError: Assert failed: :nodejs target with :none optimizations requires a :main entry
(not (and (= target :nodejs) (= optimizations :none) (not (contains? opts :main))))
	at cljs.closure$check_node_target.invokeStatic(closure.clj:2352)
	at cljs.closure$check_node_target.invoke(closure.clj:2349)
	at cljs.closure$validate_opts.invokeStatic(closure.clj:3017)
	at cljs.closure$validate_opts.invoke(closure.clj:3011)
	at cljs.closure$build.invokeStatic(closure.clj:3059)
	at cljs.closure$build.invoke(closure.clj:3023)
	at cljs.closure$watch$buildf__6288.invoke(closure.clj:3276)
	at cljs.closure$watch.invokeStatic(closure.clj:3344)
	at cljs.closure$watch.invoke(closure.clj:3246)
	at cljs.repl$repl_STAR_$fn__6922$fn__6927.invoke(repl.cljc:1193)
	at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:834)
The error makes me think that maybe it's intentional that it doesn't work, but I'm not sure with the whole nodejs thing in there...

dominicm 2020-04-26T08:36:25.129900Z

fwiw, I do have a :main option.

dominicm 2020-04-26T08:49:15.130800Z

Ah, easy one. add-implicit-options changes the target to be :nodejs, and that is what is validated against, instead of what I actually used. Should the watch option be usable with :bundle?

dpsutton 2020-04-26T09:34:19.131500Z

seems like the quickstart guide's sample node application is broken on 742 right now. https://clojure.atlassian.net/browse/CLJS-3237

dnolen 2020-04-26T10:36:49.132500Z

@dominicm need more information, what is your full command?

dominicm 2020-04-26T10:37:28.132900Z

@dnolen clj -m cljs.main -co build.edn -w src -c -r with:

{:main io.dominic.hxadapound.core
 :output-to "out/index.js"
 :output-dir "out"
 :target :bundle
 :bundle-cmd {:none ["npx" "webpack" "--mode=development"]
              :default ["npx" "webpack"]}}

dnolen 2020-04-26T10:39:09.133500Z

@dominicm looks fine, can you file a JIRA w/ just that config? thanks - fine to mark major

dominicm 2020-04-26T10:41:55.134200Z

Yep

dominicm 2020-04-26T10:42:05.134500Z

@dnolen 1.10.742 appears to be missing from versions on jira

dominicm 2020-04-26T10:47:31.134900Z

CLJS-3238 πŸ™‚

dnolen 2020-04-26T11:55:28.135100Z

thanks!

john 2020-04-26T13:34:22.136800Z

@dnolen I'm also getting a similar error - missing main file for nodejs - when trying to use :modules. I also tried adding :nodejs-rt false to no avail. Is combining :bundle with :modules an intended use-case?

dnolen 2020-04-26T13:36:04.137700Z

@john :bundle + :modules is not expected to work (because not tested, not intentionally) and no specific timeline for when it will

dnolen 2020-04-26T13:36:32.138300Z

if somebody wants to work on that be my guest - it should not be very difficult

john 2020-04-26T13:36:55.138500Z

Yeah I might take a look

john 2020-04-26T13:37:26.139500Z

I guess a JS person in NPM land is already juggling a few other loaders

dnolen 2020-04-26T13:37:33.139700Z

I'm looking at the main issue today so at that won't obfuscate the problem if there is one

john 2020-04-26T13:38:08.140500Z

k cool

dnolen 2020-04-26T13:38:10.140600Z

@john :re codesplitting it should just be kept simple if there any issues

dnolen 2020-04-26T13:38:32.141200Z

but the idea is that code splitting the node_modules beneath the top-level stuff is impractical

dnolen 2020-04-26T13:38:40.141500Z

we just don't care about that

dnolen 2020-04-26T13:38:59.141900Z

the current module graph algorithm can tell us where the top level should go

dnolen 2020-04-26T13:39:32.142400Z

so it should be roughly ok - then you run the bundler on each of your outputs

john 2020-04-26T13:40:05.142800Z

K

dnolen 2020-04-26T13:40:20.143200Z

anyways code splitting is definitely meant to work with bundle - but I'm happy to see somebody else work on it

john 2020-04-26T13:41:33.144400Z

I mean I'll try, but the JS stuff is still a little alien to me. If nothing else I'll try to get the ball pushed down the road a bit.

dnolen 2020-04-26T13:42:59.144800Z

@john let's see if you get further when I fix this other problem

john 2020-04-26T13:44:16.145800Z

Okay. You want a ticket for this module/bundle issue? Or just wait?

dnolen 2020-04-26T14:09:55.146900Z

Just wait since it’s not clear

πŸ‘ 1
dnolen 2020-04-26T15:05:57.147200Z

@dominicm master is fixed

dnolen 2020-04-26T15:06:15.147800Z

@john fixed a few things - not sure if it will matter for the :modules stuff happy to take a report now

dominicm 2020-04-26T15:06:26.147900Z

@dnolen I'll give it a spin :)

dnolen 2020-04-26T15:07:31.148300Z

@dominicm I also included :stderr which should help w/ failures

dnolen 2020-04-26T15:08:16.148800Z

you probably want --no-color in your webpack command to make that slightly easier to look at

john 2020-04-26T15:08:52.149200Z

@dnolen okay

dominicm 2020-04-26T15:23:46.149300Z

@dnolen that works great, thanks

1
dpsutton 2020-04-26T16:43:53.150200Z

> This also means you can start a node REPL now with clj -m cljs.main -t node -r big fan of not needed --re if you set the target. i mixed that up a few times and its always confusing for a second

πŸ’― 2
dnolen 2020-04-26T17:04:12.151200Z

@dpsutton yeah

2020-04-26T20:15:16.151700Z

Where did you get the quote?

dnolen 2020-04-26T20:57:47.152500Z

I reviewed the AOT cache stuff, I forgot how little code is involved

dnolen 2020-04-26T20:59:13.154Z

would be quite significant boost for dev builds

πŸ‘ 1
dnolen 2020-04-26T20:59:41.154500Z

esp since it means you can blow away :output-dir and still get a quick build

dnolen 2020-04-26T20:59:52.154800Z

also for switching between dev/advanced

thheller 2020-04-26T21:11:55.155400Z

I'd advise caution for anything AOT cache related and sharing between dev/advanced

thheller 2020-04-26T21:12:16.155900Z

there are plenty of macros that will emit different stuff based on compiler settings the compiler does not account for when checking caches

dnolen 2020-04-26T21:13:07.156200Z

AOT cache doesn't share

dnolen 2020-04-26T21:13:27.156500Z

but also this will behind a flag

thheller 2020-04-26T21:13:37.157Z

> also for switching between dev/advanced

dnolen 2020-04-26T21:13:38.157200Z

and it won't be on by default - just for people who know it will work

thheller 2020-04-26T21:13:42.157300Z

I guess I misinterpreted that then

dnolen 2020-04-26T21:13:59.157700Z

:aot-cache is only enabled for cljs.main

dnolen 2020-04-26T21:14:34.158100Z

re: macros that are problem - that the point of the flag