victorb 2020-06-18T14:57:57.327700Z

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?

bhauman 2020-06-18T14:59:15.328300Z

@victorbjelkholm429 I’m assuming your using figwheel.main?

victorb 2020-06-18T15:32:21.328800Z

@bhauman yes indeed, I hope I reached the right channel for figwheel-main questions 😄

bhauman 2020-06-18T15:32:42.329200Z

just checking

bhauman 2020-06-18T15:33:17.329900Z

so how are you currently doing your npm stuff? are you using the new :bundle target

bhauman 2020-06-18T15:33:18.330100Z


victorb 2020-06-18T15:37:56.331100Z

@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

victorb 2020-06-18T15:39:24.333100Z

my question comes after asking before and starting to evaluate options on how to use vanilla (kindish, jsx) js code inside a existing cljs application (built with figwheel-main)

bhauman 2020-06-18T15:40:52.334200Z

yeah I think target bundle is perfect for you for now

bhauman 2020-06-18T15:41:11.334600Z

as the bundler is the last part of the compilation phase

victorb 2020-06-18T15:43:31.336800Z

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

bhauman 2020-06-18T15:44:11.337400Z

yes, that’s what I’m suggesting

bhauman 2020-06-18T15:44:24.337900Z

oh but yes its not simple

victorb 2020-06-18T15:44:52.339100Z

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

victorb 2020-06-18T15:45:43.340900Z

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)

bhauman 2020-06-18T15:47:08.341900Z

so you can run webpack with a watcher right?

bhauman 2020-06-18T15:47:51.342400Z

if thats all you want is it to re-compile on javascript file changes

bhauman 2020-06-18T15:48:40.342800Z

but also you should read this to understand your options

victorb 2020-06-18T15:57:30.343900Z

@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

bhauman 2020-06-18T16:01:51.347400Z

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

bhauman 2020-06-18T16:03:29.348600Z

you’d have to manually reload the browser anyway, I think.

bhauman 2020-06-18T16:04:24.349400Z

hot reloaded bundler based javascript isn’t a thing in figwheel