How does figwheel determine which script to load in the webpage it serves? I added a clojurescript library to my leiningen project and now figwheel is trying to serve "/js/compiled/library.js" instead of "/js/compiled/app.js" like it used too... the end result is my app doesn't run
@bfast the :main
option determines the main namespace to be loaded in the :output-to
file
@bhauman in the :figwheel map, or the cljsbuild compiler map?
in the compiler options map
very strange.... we have that set to our "app" not the library
:main app-name.core
in our dev profile
and if you look at the contents of your output to file you will see it requiring that,
you likely need to clean out your compiled assets
its probably just not finding the library where you are requiring it
the strange thing is the "uberjar" production build seems to work
where is the index.html file generated?
it seems to me the problem is that it is attempting to load something other than the output to file
the index.html is initially generated by the lein figwheel template in resources/public
@bfast ^
that isn't present in this project
maybe it got deleted?
does it auto-regenerate one?
nope
figwheel itself neither serves or auto generates an index
we are using the "ring-handler" feature
perhaps you are using something generated by another generator
which is returning html as a string to the "/" endpoint
which is hard coded to load js/compiled/app.js?version=%s
did you ensure that you cleaned the compiled assets and then recompiled?
I have done git clean -fxd, lein clean, then "lein with-profiles +dev figwheel dev"
If I were you I would use chrome devtools to look at the loaded html and the network loads to determine what specifically is going on
Ok the "library" project contains a resources/public/index.html
it seems that is being served by figwheel in the new project
ok well that's a big problem
well "app" project I should say
Can I exclude that file?
The library is a UI library that is setup to work with figwheel + devcards
the library needs to be changed period
can devcards generate its own "index.html" ... or how do i get hot reloading to work in that project
no it doesn't, but you don't have to have index.html , it can be library-cards.html or cards/index.html whatever you want it to be
Ah ok ... yeah we are using cards.html... but somehow an index.html file is there too
@bfast in the libary project I would put your cards.html
index.html in dev-resources/public
and that will be excluded from consumers of the library and then in your current project put a copy of cards.html
in your dev-resources/public
this gives you much more control and you don't end up with the weird shadowing
Is the issue that figwheel serves the resources directory by default?
yes it serves all resources that are in a public subdirectory
how does figwheel serve "dev-resources"?
do I have to change the resource path in a dev profile?
nope dev-resrouces are only available in dev profile which is on during development for the current project
so its a leiningen quirk?
yes
Thanks so much for your help here