我们正在构建一个Ember/Java应用程序,并且在maven构建过程中使用Rhino预编译我们的工具栏模板。直到今天,我们还在使用车把RC3和Ember RC3,生活是美好的。今天,我们尝试更新到Ember RC6和Handlebar 1.0.0,现在我们的Rhino预编译器给出了如下内容:
js: "src/main/js/third-party/handlebars-1.0.0.js", line 2024: uncaught JavaScript runtime
exception: TypeError: Cannot call method "replace" of undefined
at src/main/js/third-party/handlebars-1.0.0.js:2024
at src/main/js/third-party/handlebars-1.0.0.js:2038
at src/main/js/third-party/handlebars-1.0.0.js:1747
at src/main/js/third-party/handlebars-1.0.0.js:1368
at src/main/js/third-party/handlebars-1.0.0.js:1860
at src/main/js/third-party/handlebars-1.0.0.js:1356
at src/main/js/third-party/handlebars-1.0.0.js:1860
at src/main/js/third-party/handlebars-1.0.0.js:1356
at src/main/js/rhino-handlebars-precompiler.js:75 (precompile)
at src/main/js/rhino-handlebars-precompiler.js:89 (init)
at src/main/js/rhino-handlebars-precompiler.js:93
at src/main/js/rhino-handlebars-precompiler.js:15我们已经尝试了我们自己的Rhino编译器和这里找到的一种:https://github.com/locnguyen/ember-rhino-precompiler。
更新
在深入研究一下车把之后,似乎车把-1.0.0产生了与车把RC3略有不同的操作码,特别是缺少了对_triageMustache助手的调用。对于这个车把碎片:
{{#if enableLinks}}<a href="/foo?userId={{unbound loginAsAdminId}}&userAsId={{unbound legacyUserId}}" id="logoutAsLink">Return to {{loginAsAdminName}}</a>{{/if}}通过RC3,我们可以得到以下内容:
in compile appendContent "<a href="/userportal/returnToAdmin?userId="
getContext 0
pushStringParam "loginAsAdminId" "ID"
pushProgram
pushProgram
emptyHash
invokeKnownHelper 1 "unbound"
appendEscaped
appendContent "&userAsId="
getContext 0
pushStringParam "legacyUserId" "ID"
pushProgram
pushProgram
emptyHash
invokeKnownHelper 1 "unbound"
appendEscaped
appendContent "" id="logoutAsLink">Return to "
getContext 0
pushStringParam "loginAsAdminName" "ID"
pushProgram
pushProgram
emptyHash
invokeKnownHelper 1 "_triageMustache"
appendEscaped
appendContent "</a>"在1.0.0中,我们得到如下信息:
in compile appendContent "<a href="/userportal/returnToAdmin?userId="
getContext 0
pushStringParam "loginAsAdminId" "ID"
pushProgram
pushProgram
emptyHash
invokeKnownHelper 1 "unbound"
appendEscaped
appendContent "&userAsId="
getContext 0
pushStringParam "legacyUserId" "ID"
pushProgram
pushProgram
emptyHash
invokeKnownHelper 1 "unbound"
appendEscaped
appendContent "" id="logoutAsLink">Return to "
getContext 0
pushStringParam "loginAsAdminName" "ID"
pushProgram
pushProgram
emptyHash
invokeHelper 1
appendEscaped
appendContent "</a>"注意,对invokeHelper的最后一次调用缺少了助手名。事情就在那里开始恶化。我还不太清楚车把为什么会漏掉这个。
谢谢你,斯科特
发布于 2013-06-26 13:01:06
在这里回答我自己的问题:很明显,Ember RC6与工具栏1.0.0不兼容。查看这个线程(我知道它引用了RC5,但问题仍然存在于RC6中):http://discuss.emberjs.com/t/ember-rc-5-is-not-working-properly-with-handlebars-1-0-0/1391
我通过选择这个提交来解决这个问题:https://github.com/emberjs/ember.js/commit/4023186ea157a8687ac611181e2ca49e5fc891d5
https://stackoverflow.com/questions/17300241
复制相似问题