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...fwiw, I do have a :main option.
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?
seems like the quickstart guide's sample node application is broken on 742 right now. https://clojure.atlassian.net/browse/CLJS-3237
@dominicm need more information, what is your full command?
@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"]}}
@dominicm looks fine, can you file a JIRA w/ just that config? thanks - fine to mark major
Yep
@dnolen 1.10.742 appears to be missing from versions on jira
CLJS-3238 π
thanks!
@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?
@john :bundle
+ :modules
is not expected to work (because not tested, not intentionally) and no specific timeline for when it will
if somebody wants to work on that be my guest - it should not be very difficult
Yeah I might take a look
I guess a JS person in NPM land is already juggling a few other loaders
I'm looking at the main
issue today so at that won't obfuscate the problem if there is one
k cool
@john :re codesplitting it should just be kept simple if there any issues
but the idea is that code splitting the node_modules
beneath the top-level stuff is impractical
we just don't care about that
the current module graph algorithm can tell us where the top level should go
so it should be roughly ok - then you run the bundler on each of your outputs
K
anyways code splitting is definitely meant to work with bundle - but I'm happy to see somebody else work on it
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.
@john let's see if you get further when I fix this other problem
Okay. You want a ticket for this module/bundle issue? Or just wait?
Just wait since itβs not clear
@dominicm master is fixed
@john fixed a few things - not sure if it will matter for the :modules
stuff happy to take a report now
@dnolen I'll give it a spin :)
@dominicm I also included :stderr
which should help w/ failures
you probably want --no-color
in your webpack command to make that slightly easier to look at
@dnolen okay
@dnolen that works great, thanks
> 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
@dpsutton yeah
Where did you get the quote?
commit message for the fix for https://clojure.atlassian.net/browse/CLJS-3237 https://github.com/clojure/clojurescript/commit/6c3276e3248c7e1b9fa3a6d00cffe77ad2860853
I reviewed the AOT cache stuff, I forgot how little code is involved
https://clojure.atlassian.net/projects/CLJS/issues/CLJS-3240
would be quite significant boost for dev builds
esp since it means you can blow away :output-dir
and still get a quick build
also for switching between dev/advanced
I'd advise caution for anything AOT cache related and sharing between dev/advanced
there are plenty of macros that will emit different stuff based on compiler settings the compiler does not account for when checking caches
AOT cache doesn't share
but also this will behind a flag
> also for switching between dev/advanced
and it won't be on by default - just for people who know it will work
I guess I misinterpreted that then
:aot-cache
is only enabled for cljs.main
re: macros that are problem - that the point of the flag