// ember-cli-build.js
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
// Add options here
});
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
app.import('vendor/my-awesome-named-amd-library.js');
return app.toTree();
};
1条答案
按热度按时间3vpjnl9f1#
欢迎使用Stack Overflow!
所以你不能直接在Ember中使用require.js,但是Ember加载器会为你构建一个require.js版本。你只需要确保你要使用的库是命名的AMD或UMD格式,然后你可以使用app.import从你的ember-cli-build文件中导入它们,如下所示:
如需详细信息,请参阅:https://ember-cli.com/user-guide/#standard-named-amd-asset
或者,查看您要使用的库的版本是否是npm格式,
ember-auto-import
可以找出格式并为您完成工作。