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

Confusing project.clj syntax error #742

Open paddymul opened 4 years ago

paddymul commented 4 years ago

I am new to figwheel and clojurescript. I started from https://github.com/reagent-project/reagent-template . I have been trying to configure cider with emacs. While following those instructions I added the line :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]} to my project.clj. .

This caused the following syntax error when running lein fighweel

(base)  ~/code/reag-play  [master] $ ~/bin/lein 
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
java.lang.Exception: Error loading /Users/paddy/code/reag-play/project.clj

snip

Caused by: clojure.lang.Compiler$CompilerException: Syntax error reading source at (/Users/paddy/code/reag-play/project.clj:115:37).
#:clojure.error{:phase :read-source, :line 115, :column 37, :source "/Users/paddy/code/reag-play/project.clj"}
 at clojure.lang.Compiler.load (Compiler.java:7642)

Eventually I figured out that this error was caused by an existing :repl-options declaration in the same block. Once I figured out that I was redeclaring :repl-options it was easy to fix the problem. The syntax error stack trace was not helpful at all.

I would have expected an error describing the duplicate key.

I'm not sure about the suggested fix. Maybe an explicit instruction to look out for this case on fighweel NRepl instructions

I could also see the case that this is a bug with Leiningen.

Keep up the good work on Figwheel.