-
-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cljs 1.10.x worker target support #659
Conversation
There's more where that came from...
@@ -120,7 +120,8 @@ | |||
|
|||
(defonce local-persistent-config | |||
(let [a (atom {})] | |||
(when (feature? js/localStorage "setItem") | |||
(when (and (html-env?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in the description, I don't understand why feature?
doesn't work on its own here as it has in the past. Explicit checking for html-env?
seems naive, since it might be provided by a polyfill/lib in non-browser environments.
Ah, just took a look at #638 My original solution for the localStorage issue was definitely bad. |
OK, figured it out! the As usual, the solution to a macro problem turns out to be more macros. |
d5dbb3e
to
96dd111
Compare
This seems like it would work really well. And since it's additive there are no backwards compatability problems. I'm assuming you have tested this and it works fine? |
Sorry, was out of the loop for a few days! Yeah, I've tested it in the browser, a worker, and node, don't currently have react-native set up. |
As of clojure/clojurescript@e380903, ClojureScript is getting a proper compiler
:target
option for WebWorkers::webworker
.This is great, as it means the hacky process I outlined here will no longer be necessary, since worker builds with
:optimizations :none
can now set a:main
. The flipside is that figwheel needs to expect such cases during pre-compilation steps and script injection.This pull:
:webworker
to the valid targets in the specfeature?
check during the definition oflocal-persistent-config
throws a runtime error.Since this check is present in previous versions of figwheel that work fine with workers, and the same check runs fine inside a function, I'm guessing it has something to do with changes to the cljs compiler, so my fix for this should be regarded with suspicion.I realize that this might be a little premature given how new the worker support in Cljs is, but at the very least I hope it is informative! Thanks again for figwheel!