如何使 figwheel 以自定义初始名称空间开始?

How can I make figwheel start with a custom initial namespace?

我的 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

start-figwheel! 仅启动图形轮逻辑。关于您的发现:

;; 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`

它确实找到了它的配置,但是 it's only :figwheel submap of project.clj

:repl-options 在 REPL 启动时使用。似乎 figwheel-sidecar.repl-api/cljs-repl 不允许指定 REPL 选项并且它不会从 project.clj.

中读取它们

您可以尝试从 lein repl 开始,其中 project.clj 的 :repl-options 使用 :init 选项来提供您要执行的代码而不是独立脚本.