I have a bunch of JS files that gets compiled via webpack then included into a cljs application. Things are working fine so far, but I'd really like figwheel (who triggers the run of the webpack cli when it sees changes) to trigger a compile when any of the JS files changes. Is there any way of achieving this?
@victorbjelkholm429 I’m assuming your using figwheel.main?
@bhauman yes indeed, I hope I reached the right channel for figwheel-main questions 😄
just checking
so how are you currently doing your npm stuff? are you using the new :bundle
target
?
@bhauman my understanding was that :target :bundle
is when I want to use cljs code in js-land, not the other way around. I'm currently running webpack externally before starting fighweel-main, and then the :npm {:bundles ....}
option for figwheel
my question comes after asking https://clojurians.slack.com/archives/C03S1L9DN/p1592378205059000 before and starting to evaluate options on how to use vanilla (kindish, jsx) js code inside a existing cljs application (built with figwheel-main)
yeah I think target bundle is perfect for you for now
as the bundler is the last part of the compilation phase
hm, no, what I'd like is the other way around, as I'm trying to get JS components to work within a CLJS app, not CLJS components within a JS app
yes, that’s what I’m suggesting
oh but yes its not simple
I guess I'm misunderstanding the "bundler is the last part of the compilation phase", as I think I need the bundler to run first, before cljs-build starts it's compilation
something "dirty" that would kind of work would be to have an option like ":css-dirs" but more ":arbitrary-dirs" that it would watch and recompile when seeing changes there (but obviously the name is made on the spot and not meant to be serious)
so you can run webpack with a watcher right?
if thats all you want is it to re-compile on javascript file changes
but also you should read this to understand your options https://figwheel.org/docs/npm.html
@bhauman yeah, running webpack externally with a watcher is fine, but I cannot get figwheel to recompile when the bundle changes, as figwheel seems to only watch either css files or cljs/cljc files, I couldn't find any options for arbitrary files
hmmm even if a bundle change triggers a compile, the reloaded code won’t work, because the bundle changes aren’t going to get hot loaded into the browser
you’d have to manually reload the browser anyway, I think.
hot reloaded bundler based javascript isn’t a thing in figwheel