问题标签 [cljsbuild]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
compilation - 项目组织和 cljsbuild 配置需要命名空间
如何组织我的项目结构并将 cljsbuild 配置为需要我自己的命名空间?例如在我的project/src-cljs
文件夹中,我有:
我想file1.cljs
(namespaced as file1.file1
) 和file2.cljs
(namespaced as file2.file2
) 要求required.cljs
(namespaced asrequired.required
)。
我的:cljsbuild
样子:
当我(:require [required.required :as required])
编译时,我得到了异常:
Caused by: clojure.lang.ExceptionInfo: No such namespace: required.required, could not locate required/required.cljs, required/required.cljc, or Closure namespace "required.required" at line 1 src-cljs/project/file1/file1.cljs
leiningen - 第二次构建目标时出现奇怪的意外错误
我打开了 cljsbuild 的详细程度以试图了解发生了什么,我第一次运行 lein cljsbuild 时看到这个:
请注意,它说它正在优化 12 个来源。当我再次运行它时,只需稍作改动,以便重新编译 target/js/server-side.js,就会发生这种情况:
那么现在它说它正在优化 13 个来源和繁荣!它失败。任何想法为什么?
进入一些细节,我的 project.clj 看起来像这样:
这些都是我的项目中提到的 goog.provide('cljs.nodejs') :
projectx.node,一个包含在服务器端但不包含在应用程序中的文件包含:
如果我从这个文件中删除 nodejs 的提及或者如果我删除:target :nodejs
,那么问题就会消失(但我与 NodeJS 的兼容性也会消失)。
如果有用,CLASSPATH 包含:
clojure - 如何进行 clojurescript 应用程序的发布/部署构建?
我准备发布我的 clojurescript 应用程序。目前我正在lein ring uberjar
创建我的 jar,它确实构建了 cljs,但我没有看到任何关于如何进行发布构建的文档——我需要做任何连接/缩小/bla bla bla 吗?是否有特殊的发布选项?
这是我在 project.clj-> 中的 cljsbuild 设置
感谢所有帮助。谢谢!
clojure - ClojureScript's separate builds for multipage web app
I have a web app that uses Clojure on backend and ClojureScript on frontend, and it consists of several pages, each requiring appropriate builded js file.
Now I know that cljsbuild can build separate builds (if specified in :builds section of config file), provided that each build has it's own folder.
Problem is: now I need to duplicate some shared code in each folder in order to build properly. Besides, it's really annoying that I have to create whole new folder for even trivial cljs file to be used, not to mention editing every time the :builds section of my project.clj.
So, it's 2016, and all the tutorials on ClojureScript I've seen so far, are for single-page applications. Are there any resources or best practices for what I'm looking for, am I missing something out?
How do I use ClojureScript in standard multi-page Clojure-stack web app?
Thanks.
clojure - Clojure 中 cljsbuild 加载缓慢
我是 Clojure 的新手,我正在尝试设置一个开发环境,我可以在其中使用 ring-server 和 cljsbuild 动态加载我的 Web 项目文件
我的项目文件中有以下代码段
我使用这个片段来运行我的服务器
我正在使用 Optimus 加载我的资产
当我运行lein with-profile dev pdf start-server, cljsbuild auto
并打开我的网站时,由“dev”构建编译的 js 文件及其依赖项需要永远完成加载。为什么环服务器这么慢?
我应该以这种方式引用构建文件吗?我应该将它捆绑到一个文件中吗?
使用的配置文件用于开发目的。
clojurescript - lein figwheel vs lein cljsbuild auto
lein figwheel 和 lein cljsbuild auto 有什么区别,因为我相信它们都是用来编译 clojurescript 的。
另外使用其中一个有什么好处吗?
emacs - 在 Emacs 中的 Cider 中,有没有办法重新启动 Figwheel 以检测新的依赖项?
我向我的 Clojurescript 应用程序添加了一个新的依赖项,我想知道我是否可以运行一个函数,比如(restart-figwheel)
重新启动 Figwheel。我读到您必须重新启动 Figwheel 才能检测新的依赖项。
clojure - 升级 Clojurescript '1.9.494' 后得到 JSC_PARSE_ERROR
将我的 Clojurescript 版本升级1.8.51
到后,1.9.494
我收到以下错误:
它说Successfully compiled
但它不反映新代码。
Successfully compiled "resources/public/js/app.js" in 11.472 seconds.
当我切换到1.8.51
版本时,一切正常。
compilation - 在 :prod 配置文件下使用 NPM 模块编译 cljs prj 时出现“a is undefined”
我遵循了这个方法:http: //blob.tomerweller.com/reagent-import-react-components-from-npm,效果很好。我什至设法在这个 re-frame 示例应用程序之上使用了我自己的 NPM 模块之一:https ://github.com/Day8/re-frame/tree/master/examples/simple/
使用以下命令启动生成的应用程序:
一切正常,但是当我这样做时:
我得到一个TypeError: a is undefined
. 有什么想法可以解决这个问题吗?
让我为您提供代码:错误的提交在这里,而配置文件在这之前的提交中都:dev
可以:prod
正常工作。
更新:我设法修复了这样的编译版本(参见提交):
在我看来,这似乎是一个编译错误配置或错误。
更新 2:如果我设置:optimizations
为:simple
(was :advanced
),我的代码编译正常。请参阅有关此选项的 cljs 编译器文档。
谢谢。