I want to add an SDK type to ember-cli to wrap up complex ajax calls into a simple javascript wrapper returning a known format of POJO that can be tested.
I added an app/sdk/login.js and exported a simple empty class there. When I import it elsewhere I get a broccoli error:
ENOENT, no such file or directory 'F:\Projects\insm-ui\tmp\tree_merger-tmp_dest_ dir-JOQL1Mli.tmp\sdk\login.js'
Standard ember-cli way:
// sdk/login.js
import Ember from 'ember';
export function initialize(container, application) {
container.register('sdk:login', LoginSdk);
}
export default Ember.Object.extend({
});
// somewhere else
import LoginSdk from 'sdk/login'; // this line errors as above in broccoli
What's the correct way to do this?
You need to use relative paths for local files in your import statement. You didn't give the path to the "somewhere else" file. But let's say it's a controller at app/controllers/my-controller.js
and your sdk is at app/sdk/login.js
.
You could import it in the controller like:
import LoginSdk from '../sdk/login';