Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figwheel always reloads dev.cljs #92

Closed
tuhlmann opened this issue Feb 17, 2015 · 3 comments
Closed

Figwheel always reloads dev.cljs #92

tuhlmann opened this issue Feb 17, 2015 · 3 comments

Comments

@tuhlmann
Copy link

I'm setting up a simple figwheel project using lein new figwheel fig1, then doing a lein figwheel.
This starts the app and I can change something in core.cljs and the app gets reloaded. I just don't understand why it also reloads dev.cljs:

Edits to this text should show up in your developer console.
utils.js:49 Figwheel: trying to open cljs reload socket
utils.js:49 Figwheel: socket connection established
utils.js:49 Figwheel: notified of file changes
core.js:48 xEdits to this text should show up in your developer console.
utils.js:49 Figwheel: loaded these files
utils.js:62 ("fig1/core.js" "fig1/dev.js")

I have this same problem with a lein new reagent project I'm trying to set up. In that case it tries to rebuild the Weasel connection each time I change something in core.cljs. The workaround I found is to add ^:figwheel-no-load to dev.cljs.

Am I doing something wrong?

@bensu
Copy link
Contributor

bensu commented Feb 17, 2015

dev.cljs gets recompiled every time because it depends on core.cljs and a new feature of the ClojureScript compiler is to recompile dependent namespaces to avoid stale code and inconsistencies. This is desirable behavior.

If you want to avoid compilation it's fine if you use ^:figwheel-no-load. In case you also need reloading in dev.cljs, but want to keep the Weasel connection, try defonce on an atom that remembers if Weasel is connected. That way, dev.cljs will be reloaded but Weasel's connection won't notice. If you run into trouble we could make a pull request to reagents template.

@tuhlmann
Copy link
Author

Thanks for the explanation!

@bhauman
Copy link
Owner

bhauman commented Feb 17, 2015

It's also important to note that adding :recompile-dependents false to your build config disables this behavior. I'm starting to think that this should be the default for figwheel builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants