The project.clj of my clojurescript code specifies :repl-options {:init-ns my-project.core}
and I start figwheel via start-figwheel!
. In the figwheel documentation it says that
;; 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`
But when figwheel starts, it puts me into the cljs.user
namespace. How can I make figwheel pick up this option?
My figwheel.clj looks as follows:
(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)
I am basically asking this question from Google groups.
start-figwheel!
only starts figwheel logic. Regarding your finding that:
;; 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 indeed finds its config but it's only :figwheel
submap of project.clj
.
:repl-options
are used by REPL when it starts. It seems that figwheel-sidecar.repl-api/cljs-repl
doesn't allow specifying REPL options and it doesn't read them from project.clj
.
You might try to play with starting lein repl
where project.clj's :repl-options
use :init
option to provide the code you want to execute instead of a standalone script.