Fork me on GitHub
#cljs-dev
<
2020-04-26
>
dominicm08:04:02

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

dominicm08:04:25

fwiw, I do have a :main option.

dominicm08:04:15

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?

dpsutton09:04:19

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

dnolen10:04:49

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

dominicm10:04:28

@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"]}}

dnolen10:04:09

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

dominicm10:04:05

@dnolen 1.10.742 appears to be missing from versions on jira

dominicm10:04:31

CLJS-3238 πŸ™‚

john13:04:22

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

dnolen13:04:04

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

dnolen13:04:32

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

john13:04:55

Yeah I might take a look

john13:04:26

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

dnolen13:04:33

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

dnolen13:04:10

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

dnolen13:04:32

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

dnolen13:04:40

we just don't care about that

dnolen13:04:59

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

dnolen13:04:32

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

dnolen13:04:20

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

john13:04:33

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.

dnolen13:04:59

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

john13:04:16

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

dnolen14:04:55

Just wait since it’s not clear

πŸ‘ 4
dnolen15:04:57

@dominicm master is fixed

dnolen15:04:15

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

dominicm15:04:26

@dnolen I'll give it a spin :)

dnolen15:04:31

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

dnolen15:04:16

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

dominicm15:04:46

@dnolen that works great, thanks

4
dpsutton16:04:53

> 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

πŸ’― 8
David Pham20:04:16

Where did you get the quote?

dnolen20:04:47

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

dnolen20:04:13

would be quite significant boost for dev builds

πŸ‘ 4
dnolen20:04:41

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

dnolen20:04:52

also for switching between dev/advanced

thheller21:04:55

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

thheller21:04:16

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

dnolen21:04:07

AOT cache doesn't share

dnolen21:04:27

but also this will behind a flag

thheller21:04:37

> also for switching between dev/advanced

dnolen21:04:38

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

thheller21:04:42

I guess I misinterpreted that then

dnolen21:04:59

:aot-cache is only enabled for cljs.main

dnolen21:04:34

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