简体   繁体   English

leiningen 中的 Clojurescript 编译器选项

[英]Clojurescript compiler options in leiningen

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.根据文档, :asset-path 是一个编译器选项。 What is the correct place in my leiningen configuration file for a compiler option such as:asset-path?在我的 leiningen 配置文件中,编译器选项(例如: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.我在自己的服务器上托管网站,output 文件托管在/static/cljs-out ,因此需要:asset-path 选项。

Leiningen version is 2.9.1, figwheel-main version is 0.2.16 Leiningen 版本是 2.9.1,figwheel-main 版本是 0.2.16

The:asset-path option can be placed in the build specific configuration file, dev.cljs.edn in my case. :asset-path 选项可以放在构建特定的配置文件中,在我的例子中是dev.cljs.edn 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.这个答案可能特定于figwheel-main 项目。 The rules seem to be different for cljs-build projects, as per cfrick's comment above.根据上面 cfrick 的评论, cljs-build项目的规则似乎有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM