Fork me on GitHub
#figwheel-main
<
2020-07-20
>
GGfpc09:07:21

Hi, I'm having some trouble with figwheel. I have two files in my src folder which figwheel is set to watch, and one of those files is my :main. The issue is that figwheel only includes the :main in the global javascript file that includes all else (and that we link in the html). How can I fix this?

GGfpc09:07:07

If I open the browser console I also only see the :main javascript file in my project folder

bhauman12:07:53

@ggfpc12495 if I understand you correctly that is how figwheel is supposed to work

bhauman12:07:18

but I’d need to now more before I can help you further

GGfpc16:07:24

So what I mean is that I have two html files for two different pages, index and login. For each one of those I have a cljs file, index.cljs and login.cljs. My :main in the figwheel config is myproject.index. When figwheel loads, both index.cljs and login.cljs are compiled into js, but the myproject-dev.js which is what (as far as I know) needs to be linked in the html files only includes index.js and not login.js so my login page has no javascript

bhauman18:07:40

you would need to require the login.js for it to be present @ggfpc12495

bhauman18:07:47

Also of interest is the :extra-mains functionality https://figwheel.org/docs/extra_mains.html

GGfpc18:07:28

Oh I see, so a normal workflow If I wanted to have multiple cljs files would have me require all of them in the :main one whether directly or transitively?

bhauman22:07:30

to different entry points mean two different builds

bhauman22:07:22

so for instance you could have one main file that requires both of your current mains and then decides which one to render based on perhaps some information on the page

bhauman22:07:46

that way you would have one build

bhauman22:07:20

or you could have to builds ie two .cljs.edn files and then run two instances of figwheel

bhauman22:07:35

or you can use extra-mains

bhauman22:07:40

Of all these the first suggestion of having a single main that requires your two mains and then make a decision which one to render, is the easiest

bhauman13:07:00

@daniel975 one good way to debug the production build is to compile to :whitespace not :advanced and then see what the error is

bhauman13:07:23

I’d really love to know what problem you are having. I’m probably missing something basic