AbhinavOmprakash / snitch

Snitch injects inline defs in your functions and multimethods. This enables a repl-based, editor-agnostic, clojure and clojurescript debugging workflow. It is inline-defs on steroids.
Other
101 stars 2 forks source link

shadow-cljs build fails with snitch version 0.1.15 #37

Open bpringe opened 2 months ago

bpringe commented 2 months ago

If I add version 0.1.15 of snitch to a project (shadow-cljs using deps.edn for dependency resolution), and add a require in an ns form like [snitch.core :refer [defn*]], when I run the shadow-cljs build it fails with this error:

------ ERROR -------------------------------------------------------------------
 File: jar:file:/Users/brandon/.m2/repository/org/clojars/abhinav/snitch/0.1.15/snitch-0.1.15.jar!/snitch/core.cljc:13:3
--------------------------------------------------------------------------------
  10 | ;; cljs deps can be excluded in a clojure only 
  11 | ;; project so the deps won't be available 
  12 | (try
  13 |   (require '[cljs.analyzer :as ana])
---------^----------------------------------------------------------------------
null
Alias ana already exists in namespace snitch.core, aliasing snitch.mock-analyzer at line 13 snitch/core.cljc
--------------------------------------------------------------------------------
  14 |   (catch Exception _
  15 |     (require '[snitch.mock-analyzer :as ana])))
  16 | 
  17 | 
--------------------------------------------------------------------------------

If I go back to snitch version 0.1.14, the build succeeds.

AbhinavOmprakash commented 2 months ago

Hey, thanks for reporting. I'm aware of this. I just haven't gotten around to fixing it.

I'm not sure what the best way to fix it is. I removed the the clojurescript dependency from the clojure project because I was having some issues with dependency conflicts due to libraries being pulled by clojurescript.

someone suggested that I separate snitch into 2 jars, one for clojure and one for clojurescript. I'm not too keen on doing that.

do you think there's any other way?

bpringe commented 2 months ago

Hmm. I haven't looked into the issue, but can you exclude the dependencies being pulled in by ClojureScript that cause an issue, using Lein's method of doing that in the project.clj?

That error looks like you're trying to use an alias for that require which already aliases something else. Could you alias it as something other than ana or run (ns-unalias *ns* 'ana) right before (require '[cljs.analyzer :as ana]) in that try?