OK. Part 3 of me figuring out how to develop a ClojureScript project with CLI tools. (Previously was always using Lein)
Thanks to everyone’s help in the last two threads I hit upon
clojure -Tclj-new create :template figwheel-main :name myname/myapp :args '["+deps","–reagent"]'
as my way of creating a figwheel / reagent JS project using CLI tools.
I can run this with
clojure -M:fig:build
which sets up figwheel reloading etc. and lets me get on with writing my app.
I’ve now made the app I wanted to write (it wasn’t a big one) and want to deploy it. There’s no server. So I just want the HTML page + a single JS file.
There’s no immediately google-able answer to “what’s the CLI command to build a final cljs project”.
The first result : Clojure - Deps and CLI Guide doesn’t mention it. So I started following the tutorial on figwheel-main | Figwheel Main provides tooling for developing ClojureScript applications, especially the “The Build” and “Packaging up a single compiled artifact for production” sections.
So I’ve added a “build file” (as described on that page, it just contains {:main myname.myapp})
And I can now run my app with
clj -M --main cljs.main --compile myname.myapp --repl
(Though it’s not live reloading)
But when I try to run
clojure -M -m figwheel.main --optimizations whitespace --build-once myname.myapp
or just
clojure -M -m figwheel.main --optimizations whitespace --build-once myapp
I get
Exception in thread "main" java.io.FileNotFoundException: Could not locate figwheel/main__init.class, figwheel/main.clj or figwheel/main.cljc on classpath.
And obviously no single big js file.
So can anyone tell me where I’ve gone wrong here? It’s true there’s no main.clj or similar. But why is it suddenly asking for one? When for the figwheel development it doesn’t seem to need one?