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

reload-clojure causes compilation failure in portable projects #210

Closed
cemerick opened this issue Jun 16, 2013 · 2 comments
Closed

reload-clojure causes compilation failure in portable projects #210

cemerick opened this issue Jun 16, 2013 · 2 comments
Milestone

Comments

@cemerick
Copy link
Collaborator

Given a project that is attempting to provide a portable API for both Clojure and ClojureScript, any overlapping aliases in conjunction with lein-cljsbuild's reload-clojure function will produce a ClojureScript compilation failure.

In short, reload-clojure loads any Clojure files that are on its :source-paths, and because the ClojureScript compiler reuses the Clojure reader, the former creates any namespaces that have aliases defined, in order for the latter can properly resolve namespaced keywords. So, if Clojure and ClojureScript files are on lein-cljsbuild's :source-path that create analogous namespaces with identical aliases (roughly unavoidable if one is using a tool like cljx or lein-dalap to produce a portable API), ClojureScript compilation will always fail.

A minimal testcase is available here.

A partial "fix" would be to have reload-clojure be called only if lein-cljsbuild is in "auto" mode, watching for source changes, but perhaps there's a smarter, more general solution?

@brandonbloom
Copy link
Contributor

+1 I just got burned by this too

cemerick added a commit that referenced this issue Aug 30, 2013
only reload Clojure source files that define macros (fixes gh-210)
@bhauman
Copy link
Contributor

bhauman commented Dec 12, 2014

This issue seems to be resolved as of clojurescript 2202 and is certainly not present in the current release 2411. There is no longer a need to not reload non macro .clj files in cljs source directories.

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