我在尝试迁移一个应用程序应用程序以使用ember app-kit。该代码需要accounting.js库。在预应用-KIT版本的文件是在index.html
如何作为ES6模块访问凉亭软件包?
<script src="http://cdnjs.cloudflare.com/ajax/libs/accounting.js/0.3.2/accounting.min.js"></script>
通过脚本标签加载并在视图访问通过全局命名空间
App.MoneyField= Em.TextField.extend({
init: function() {
this._super();
var value = accounting.formatMoney(this.get("money")/100, '');
this.set('value', value);
};
// other functions omitted
});
在App-套件版本,我ve包括accounting.js
作为凉亭依赖。在bower.json
:
{
"name": "ember-app-kit",
"dependencies": {
"handlebars": "~1.1.2",
"jquery": "~1.9.1",
"qunit": "~1.12.0",
"ember": "~1.4.0-beta.2",
"ember-data": "~1.0.0-beta.6",
"ember-resolver": "git://github.com/stefanpenner/ember-jj-abrams-resolver.git#master",
"ic-ajax": "~0.3.0",
"ember-testing-httpRespond": "~0.1.1",
"accounting":"~0.3.2"
},
"resolutions": {
"ember": "~1.4.0-beta.2"
}
}
当我尝试建立的应用程序,它提供了错误
W117: 'accounting' is not defined.
我明白这是为什么,知道我需要某种import accounting from ...
声明。
如何导入通过bower安装的软件包作为ES6模块?
我猜'从'/供应商/会计/会计'进口会计;'。但是我试了一下,得到了以下错误:'未捕获的错误:找不到模块/供应商/会计/会计资料来源:'http:// localhost:8000/vendor/loader.js:21''。有了requirejs,我会添加一个垫片到配置文件,可惜我不知道如何使用EAK来完成。 –
显然有一些东西在不久的将来:http://emberjs.com/blog/2013/12/17/whats-coming-in-ember-in-2014.html'ember-cli'能够使垫片。 –
我为此功能创建了一个问题:https://github.com/stefanpenner/ember-app-kit/issues/511 –