bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 210 forks source link

Figwheel depends on an old version of core.async #32

Closed pangloss closed 9 years ago

pangloss commented 9 years ago

Even if I add a dependency in my project on a newer version, it still uses the old one for some reason.

Also, If I add an exclusion to figwheel for core.async in both the dependency and the plugin and then pull in the current version, I can get cljsbuild to use the right version, but then figwheel itself blows up with an odd exception, apparently related to core.cache and/or core.memoize which are depended on by core.async.

expez commented 9 years ago

I solved this by including [org.clojure/core.memoize "0.5.6"] explicitly in my project :dependencies .

Are you perhaps also using vinyasa? A similar error is reported here in regards to vinyasa, and this was the cause of my troubles.

here is another similar error report where the problem occurred with lighttable and lib-noir.

I haven't dived into the code for core.memoize but I'm starting to wonder if it's doing something unusual.

pangloss commented 9 years ago

No, I'm not using vinyasa. I just tried a few variations on the core.memoize fix you and the vinyasa bug mention, but couldn't make it work. Still tethered to core.async 0.1.278, unfortunately...

pangloss commented 9 years ago

Would it make sense to refactor the core.async dependency out of the project?

I just checked and except for one place where it gathers the results of several js file reloads on the client, core.async is only used to set timeouts.

Considering that the dependency problems being introduced are fairly substantial, I think that may be the best option.

bhauman commented 9 years ago

The server and the client in the figwheel namespace both use core.async. I would have to factor it out of both of them. It seems a shame to have such a great library and not be able to use it.

I think for now I am just going to try and bump the core.async version up to the current version. Will that work?

bhauman commented 9 years ago

Actually that won't work. It seems that this isn't a problem in figwheel as of now but rather something weird is going on in core.cache, core.memoize, core.async, and possibly leinigen.

Can you use the older version of core.async? because that version doesn't cause these problems.

pangloss commented 9 years ago

The reason I think it might be a good idea to drop core.async from this project is that it is not at all obvious why there is an old version of the library being loaded. When I did lein deps :tree, there was no mention of 0.1.278. All I knew was that despite what I had specified, the current version was not being loaded. It took me a few hours of digging before I thought to try lein deps :plugin-tree. The next person who has problems is likely to face the same confusion.

Even though updating to the current version would solve the problem for now, it will continue to be a problem going forward, both for people who want the next version in a few weeks, as well as for the people who want an older version. This seems to be a flaw with the way leiningen or cljsbuild loads dependencies, but one that probably won't go away any time soon.

Having learned that, I think it's probably best to keep dependencies in plugins like this to an absolute minimum. And I normally lean in favour of using them!

bhauman commented 9 years ago

So here's my experience. I bumped the core.async dependency and I got the same weird errors as you pangloss. I tracked it down to a tools.analyzer.jvm dependency conflict with leinigen. (The plugin runs inside of leinigen).

I then upgraded leinigen and the problem went away.

So I'm thinking you should do a lein upgrade and try your initial exclusion strategy. Let me know how this fairs for you.

To be clear this is a fight between core.async and leinigen and has nothing to do with lein figwheel.

dustingetz commented 9 years ago

For the next person: I had lein 2.3.4, upgrading to 2.5.0 fixed the issue. You can test for this issue with just lein help:

$ lein help
Leiningen is a tool for working with Clojure projects.

Several tasks are available:
check               Check syntax and warn on reflection.
classpath           Write the classpath of the current project to output-file.
clean               Remove all files from paths in project's clean-targets.
cljsbuild           Compile ClojureScript source into a JavaScript file.
compile             Compile Clojure source into .class files.
deploy              Deploy jar and pom to remote repository.
deps                Show details about dependencies.
do                  Higher-order task to perform other tasks in succession.
leiningen.figwheel  Problem loading: java.lang.RuntimeException: No such var: clojure.core.cache/through, compiling:(clojure/core/memoize.clj:52:3)
... snip ...