Clojurescript compiler options in leiningen

131 Views Asked by At

An error message in my browser has informed me that:

ClojureScript could not load :main, did you forget to specify :asset-path?

According to the documentation, :asset-path is a compiler option. What is the correct place in my leiningen configuration file for a compiler option such as :asset-path? It doesn't seem to work at the top level.

The project is freshly generated using this command:

lein new figwheel-main <name> -- --reagent

I'm hosting the website on my own server, with the output files hosted at /static/cljs-out, hence the need for the :asset-path option.

Leiningen version is 2.9.1, figwheel-main version is 0.2.16

1

There are 1 best solutions below

0
BnMcGn On BEST ANSWER

The :asset-path option can be placed in the build specific configuration file, dev.cljs.edn in my case. This file is found in the project's root folder.

^{:watch-dirs ["test" "src"]
  :css-dirs ["resources/public/css"]
  :auto-testing true
   }
{:main flaglib2.core
 :asset-path "/static/cljs-out/dev"}

This answer is possibly specific to figwheel-main projects. The rules seem to be different for cljs-build projects, as per cfrick's comment above.