使用trek的令人敬畏的Ember Todos示例中的gruntfile.js - https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences - 我收到以下错误:
Uncaught SyntaxError: Unexpected token }
这很奇怪,因为它与Ember.js RC.1完美搭配。还有其他人经历过吗?有什么想法吗?
答案 0 :(得分:2)
Ember Todos使用旧版本的中性
我没有编辑ember.js
文件,而是发现在优秀的示例应用程序中检查package.json
产生了解决方案。
只需将第14行更改为
即可
"grunt-neuter": "~0.4.0",
这会带来更新的中性,它具有正则表达式修复,可以找到/dependencies/handlebars-runtime.js
。
答案 1 :(得分:0)
FWIW,这是由于与grunt的中性过程和Handlebars的Ember代码本身中的require()语句的错误/冲突(第18358行):
var Handlebars = this.Handlebars || (Ember.imports && Ember.imports.Handlebars);
if(!Handlebars && typeof require === 'function') {
Handlebars = require('handlebars');
}
我引用了rc.3 Handlebar的JS文件 - 名称handlebars-1.0.0-rc.3 - 所以它找不到它想要的东西,一个名为handlebars.js的文件。当我将其更改为下面的声明时,一切正常:
var Handlebars = this.Handlebars || (Ember.imports && Ember.imports.Handlebars);
if(!Handlebars && typeof require === 'function') {
Handlebars = require('handlebars-1.0.0-rc.3');
}