[英]'a is undefined' when compiling a cljs prj with an NPM module under :prod profile
I followed this howto: http://blob.tomerweller.com/reagent-import-react-components-from-npm and it worked great. 我遵循了此方法: http : //blob.tomerweller.com/reagent-import-react-components-from-npm ,它的效果很好。 I even managed to use one of my own NPM module on top of this example app of re-frame: https://github.com/Day8/re-frame/tree/master/examples/simple/
在这个重新设计的示例应用程序的顶部,我什至设法使用了我自己的NPM模块之一: https : //github.com/Day8/re-frame/tree/master/examples/simple/
Starting the resulting app with: 使用以下命令启动生成的应用程序:
lein clean && lein figwheel
everything works ok, but when I do: 一切正常,但是当我这样做时:
lein do clean, with-profile prod compile
I get a TypeError: a is undefined
. 我收到
TypeError: a is undefined
。 Any idea to fix this? 有解决这个问题的主意吗?
Let me provide you with the code: the bad commit is here , while both :dev
and :prod
profiles work OK at this just previous commit . 让我为您提供代码:错误的提交在这里 ,而
:dev
和:prod
配置文件在上一次提交时都可以正常工作。
Update : I managed to fix the compiled version like this (see the commit ): 更新 :我设法修复了这样的编译版本(请参阅commit ):
return d.c?d.c(c,v,w):d.call(null,c,v,w)}}(G,r,b,c,d,e)),I=dw(G);rf.b?: […]
};w.b=v;w.c=f;return w}()}(c,d,e,f))};hf.b(ow,ik);hf.b(ow,bp);hf.b(ow,To); […]
function nx(a){var b=window.deps["react-mathjax"],
- c=window.deps.clubexpr.kf;
+ c=window.deps.clubexpr.renderLispAsLaTeX;
return new U(null,3,5,V,[Vj,b.Context,new U(null,4,null)}
function Wv(){return function(a){return function(){return new U(null,6,5,V,[…]
This seems to me a compilation misconfiguration or bug. 在我看来,这似乎是编译错误或错误。
Update 2 : my code compiles OK if I set :optimizations
to :simple
(was :advanced
). 更新2 :如果将
:optimizations
设置为:simple
(是:advanced
),我的代码将编译正常。 See the cljs compiler doc about this option . 有关此选项,请参见cljs编译器文档 。
Thanks. 谢谢。
The code that is failing is here . 失败的代码在这里 。
It looks like you might need to provide externs for clubexpr, so that the Closure Compiler knows not to rewrite renderLispAsLatex
as kf
. 看来您可能需要为clubexpr提供extern,以便Closure编译器知道不将
renderLispAsLatex
重写为kf
。 When compiling under :simple, the Closure Compiler doesn't rewrite function names, so this problem wouldn't show up. 在:simple下进行编译时,Closure Compiler不会重写函数名称,因此不会出现此问题。
As a side note, you probably shouldn't use aget
to get objects from the window, aget
is designed for array access only. 附带说明一下,您可能不应该使用
aget
从窗口获取对象, aget
仅设计用于数组访问。 To get objects, you should use goog.object/get
. 要获取对象,您应该使用
goog.object/get
。 See this post on Checked Array Access for more info on this. 有关更多信息,请参见Checked Array Access上的这篇文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.