我的目标是使用 Figwheel 和 Clojure 工具(不是 Leiningen)创建一个 ClojureScript REPL(针对 Node.js)。但是当我启动 Figwheel 时,它似乎正确启动但从未完成。
deps.edn
{:deps {org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/clojurescript {:mvn/version "1.11.60"}}
:aliases {:fig {:extra-deps {com.bhauman/figwheel-main {:mvn/version "0.2.18"}}}}
:paths ["src" "target" "resources"]}
dev.cljs.edn
{:main cljs-example.foo
:target :nodejs
:optimizations :none
:pretty-print true
:source-map true
:asset-path "js/dev"
:output-to "resources/public/js/dev.js"
:output-dir "resources/public/js/dev"}
启动命令
clj -M:fig -m figwheel.main -b dev -r
% clj -M:fig -m figwheel.main -b dev -r
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[Figwheel] Compiling build dev to "resources/public/js/dev.js"
[Figwheel] Successfully compiled build dev to "resources/public/js/dev.js" in 0.708 seconds.
[Figwheel] Watching paths: ("src") to compile build - dev
[Figwheel] Starting Server at http://localhost:9500
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. Node)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Starting node ...
Node output being logged to: resources/public/js/dev/node.log
For a better development experience:
1. Open chrome://inspect/#devices ... (in Chrome)
2. Click "Open dedicated DevTools for Node"
就是这样! :(
它永远保持这样,我从来没有得到这样的提示:
cljs.user=>
附录
我认为我的 foo.cljs
文件没有导致 Figwheel 挂起的错误。当我使用以下命令启动“本地”REPL 时:
clj -M -m cljs.main --target node --compile cljs-example.foo --repl
然后我得到:
ClojureScript 1.11.60
cljs.user=> (require '[cljs-example.foo])
i am foo!!!!!!!!
nil
cljs.user=>