【发布时间】:2016-03-30 11:00:37
【问题描述】:
我的 clojurescript 代码的 project.clj 指定 :repl-options {:init-ns my-project.core},我通过 start-figwheel! 启动 figwheel。在无花果documentation 它说
;; you can also just call (ra/start-figwheel!)
;; and figwheel will do its best to get your config from the
;; project.clj or a figwheel.edn file`
但是当 figwheel 启动时,它会将我放入 cljs.user 命名空间。我怎样才能让 figwheel 选择这个选项?
我的 figwheel.clj 如下所示:
(require '[figwheel-sidecar.repl :as r]
'[figwheel-sidecar.repl-api :as ra])
(ra/start-figwheel!
{:figwheel-options {}
:build-ids ["dev"]
:all-builds
[{:id "dev"
:figwheel {:devcards true}
:source-paths ["src"]
:compiler {:main 'my-project.core
:asset-path "js"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js"
:verbose true}}]})
(ra/cljs-repl)
我基本上是在 Google 群组中询问this question。
【问题讨论】:
-
当您从外部 REPL 客户端使用
lein repl -c或在执行(ra/start-figwheel)的同一 REPL 中连接时,命名空间是否未更改? -
我添加了我的 figwheel.clj。我正在连接我的浏览器,然后在我启动脚本的终端中显示 repl 提示符(带有
cljs.user)。我试过lein repl :connect 3449,但这只是挂了。 -
我认为
:repl-options仅用于 lein 的 repl 任务,而不是 figwheel 本身。你如何使用你的figwheel.clj?将其作为脚本执行还是在 REPL 会话中加载? -
我通过一个包含
rlwrap lein run -m clojure.main script/figwheel.clj行的bash 脚本在命令行上执行了figwheel.clj。你是对的,:repl-options很可能根本没有被选中。很多时候我觉得我没有完全了解工具,哪个流程调用其他流程。我想我需要画一些图表。