![](/img/trans.png)
[英]How to prevent a doo run if the ClojureScript compiler emits a warning
[英]How/Can I exclude inherited foreign libs from ClojureScript compiler output?
我使用的reagent 0.5.0
取决于cljsjs/react
。 后者随附以下deps.cljs
{:foreign-libs [{
:file "cljsjs/development/react.inc.js",
:file-min "cljsjs/production/react.min.inc.js",
:provides ["cljsjs.react"]}],
:externs ["cljsjs/common/react.ext.js"]}
这使得React的JavaScript最终出现在编译器输出中。
我想防止这种情况的发生,因为我也想在普通的JavaScript页面中使用React。
此外, reagent/core.cljs
具有:require [cljsjs.react]
指令(要强制包含吗?),因此不能简单地忽略依赖项。
有没有办法阻止React在编译器输出中结束?
从Reagent自述文件( https://github.com/reagent-project/reagent ):
If you want the version of React with addons, you'd use something like this instead:
[reagent "0.5.0" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "0.12.2-4"]
If you want to use your own build of React (or React from a CDN), you have to use :exclusions variant of the dependency, and also provide a file named "cljsjs/react.cljs", containing just (ns cljsjs.react), in your project.
因此,只需在依赖项中使用:exclusions选项,并提供自己的cljsjs / react名称空间即可。 此时要确保由React加载,然后由Reagent加载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.