Hello, I am trying to use Dexie in a service. I installed Dexie via npm, imported it into ember-cli via:
//ember-cli-build.js
app.import('node_modules/dexie/dist/dexie.min.js');
created a service file:
//app/services/dexie.js
import Service from '@ember/service';
import Dexie from 'dexie';
export default Service.extend({
db: null,
init() {
this._super(...arguments);
this.db = new Dexie('MyDatabase');
// Declare tables, IDs and indexes
this.db.version(1).stores({
friends: '++id, name, age'
});
},
addFriend() {
this.db.friends.add({
name: 'Camilla',
age: 25,
});
}
});
Chrome gives me this error:
Error: Could not find module
dexie
imported fromember-omnia-write/services/dexie
So my question is, how do I import this Library correctly or how can I refer to Dexie? Couldnt find any useful help on google.
Greetings
EDIT 1: I kinda fixed it myself now by adding these arguments to ember-cli-build
app.import('node_modules/dexie/dist/dexie.min.js', {
using: [
{ transformation: 'amd', as: 'Dexie' }
]
});