Fork me on GitHub
#figwheel-main
<
2020-06-18
>
victorb14:06:57

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?

bhauman14:06:15

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

victorb15:06:21

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

bhauman15:06:42

just checking

bhauman15:06:17

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

victorb15:06:56

@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

victorb15:06:24

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)

bhauman15:06:52

yeah I think target bundle is perfect for you for now

bhauman15:06:11

as the bundler is the last part of the compilation phase

victorb15:06:31

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

bhauman15:06:11

yes, that’s what I’m suggesting

bhauman15:06:24

oh but yes its not simple

victorb15:06:52

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

victorb15:06:43

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)

bhauman15:06:08

so you can run webpack with a watcher right?

bhauman15:06:51

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

bhauman15:06:40

but also you should read this to understand your options https://figwheel.org/docs/npm.html

victorb15:06:30

@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

bhauman16:06:51

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

bhauman16:06:29

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

bhauman16:06:24

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