I’m finally adding --clean
option
I’ve been wanting it for sometime, and with the new :bundle
option it’s really important that you clean the build on every compile as you are switching over from cljsjs libs to npm based libs
also a :clean-outputs true
config key that will clean as you are starting up a build
they both do the same thing
Also adding a -m figwheel.main --clean
which will clean all builds
and a -m figwheel.main --clean dev
to clean a single build
--clean
is more precise as it cleans files generated for extra-mains and bundles as well
considering adding auto-clean that detects fundamental changes, like changes to a project.clj
, deps.edn
, package.json
, package.json.lock
, yarn.lock
and then cleans, but its going to be hard to enumerate all the files that might trigger a need for clean.
Nice. I've been manually doing that for a long time.
Getting this sort of thing:
[Figwheel] Compiling build figwheel-main-option-build to "resources/public/cljs-out/figwheel-main-option-build-main.js"
internal/modules/cjs/loader.js:797
throw err;
^
Error: Cannot find module '@cljs-oss/module-deps'
when using :extra-mains
in figwheel-main
version tested [com.bhauman/figwheel-main "0.2.7"]
and [com.bhauman/figwheel-main "0.2.3"]
(older)The weird part is I have :npm-deps false
in my build
it’s looking like it is not merging that into the extra main compiler opts perhaps?
I tried to just restate it
but it still has same issue
like
:extra-main-files {:testing {:main my.cljs-test-runner
:npm-deps false}}
it also seems to output to it’s own default targets and stuff too instead of the output-dir I had specified (perhaps that is expected?)
Oh, and lastly it opens the browser url
when i do have :open-url false
again, it’s just the extra mains that seem to not participate in any of my configuration
(just trying to use async runner for console CI output - no UI)
Then I just pulled it all out into a separate test.cljs.edn instead
and went the route of calling -m figwheel.main -co test.cljs.edn -m my.main.ns
it compiled this way at least and didn’t open the browser - however, it doesn’t finish - just hangs saying “JavaScript environment will not launch automatically when :open-url is false”
with my -main
just doing this:
(defn -main [& args]
(run-tests-async 10000))
as specified in https://figwheel.org/docs/testing.html
maybe this only works with a nodejs target or something?
went down this path instead https://betweentwoparens.com/clojurescript-test-setup with js-dom and can at least run this way it seems
pretty confused still the state of the built-in stuff though I guess.
@mikerod you can’t have :npm-deps false in a :bundle build
I’ll be back later
have to go out for a bit
oh and use 0.2.8-SNAPSHOT
I am not using bundle either. Just FYI
@mikerod yeah OK so there are a few things here, have you read https://figwheel.org/docs/extra_mains.html
I read al the docs related here. Including that
My main first issue was extra mains seemed to not use my config I had for the normal main dev build
Like it opened browser that I didn’t want, also output in default area, also tried to use npm that I didn’t want
So I moved it fully to its own build setup instead and my config was then honored.
But then I just got it waiting forever with the async handler
Which not sure what is supposed to happen
So then I just did the launch js stuff with js-dom and tests run
Perhaps you always have to have a JS launcher if you aren’t using browser UI style testing?
@mikerod so there is a big bug in 0.2.7
Also extra-mains don’t let you change anything other than:
• :main
• :output-to
• :target
• :asset-path
• :closure-defines
• :preloads
another thing is that extra-mains are only to be used during dev and they are supposed to open a browser
Ok. Clears that part up then. Thanks for details
It did make it where I can’t do testing with it. I use older webpack style npm bundle
So the npm issue showed up.
Haven’t upgraded to newer cljs bundle features yet. Cutting edge stuff.
@mikerod are you saying that you had a build that worked that stopped working?
Nope
First time trying figwheel main modern testing features.
That’s when I discovers this. But it’s not a regression sort of thing
so if you have npm-deps false then it should defintely be in the extra-main as well
I can do testing via a completely separate build config though at least
Then I can configure the compiler as needed etc. just wasn’t directly in the docs.
Perhaps somewhat indirectly discoverable though.
Interesting about npm-deps
The error looked like when you don’t have it set
this could be a real bug, but again please don’t use 0.2.7 as it overwrites your main file with a test file
I don’t have enough fine grained details I know
Ok.
also using the latest ClojureScript 0.10.773 is really important as well
I’ll not use that version. I did see the same npm error with 0.2.3 though
oh
I am using latest cljs as well
Oh maybe not
https://github.com/clojure/clojurescript/blob/master/README.md#releases-and-dependency-information was using this one. Not the same
1.10.764
yeah that one has some npm-deps issues
Interesting
I think I saw issue with earlier cljs. So jumped to this one. But maybe I need to try again with the even newer.
I am not at laptop to try at the moment.
no worries but it sounds like this may be a cljs issue
I appreciate the help too
as I haven’t tested this setup
I’ll try 1.10.773 and see if that was related
When I get chance.
but you do have :npm-deps false in your build config right?
and if you do a --print-config it shows :npm-deps false
Yes. I do have it in dev build config
And my repl works
It’s just when I added extra-mains for testing
It kept failing with that classic npm issue about @oss...
yeah that’s weird
Maybe I can try to get more output on it later to see what’s going on there.
so if I wanted to reproduce this, I just use the figwheel :npm stuff?
and set npm-deps false and then add an extra-main
Yeah I think. But I do have foreign-libs
Using the old “double bundle” cljs style
yeah that shouldn’t affect it
Didn’t think so
But maybe it matters to have node_modules in the dir of project? Don’t know
it sounds like something the new CLJS introduced
Because maybe that’s what is being scanned when it shouldn’t be or something
so I’ll use 0.2.3 and cljs 0.10.764
Yep