使用来自 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 完美配合。还有人经历过这个吗?有任何想法吗?
使用来自 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 完美配合。还有人经历过这个吗?有任何想法吗?
Ember Todos 使用旧版本的中性
我没有编辑ember.js
文件,而是发现package.json
在优秀的示例应用程序中检查产生了解决方案。
只需将第 14 行更改为
"grunt-neuter": "~0.4.0",
这带来了具有正则表达式修复的更新中性,该修复设法找到/dependencies/handlebars-runtime.js
.
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');
}