0

I recently installed and imported lokijs in aurelia with jspm :

install:

jspm  install npm:lokijs

import:

import * as loki from 'lokijs'

the problem is when I want to create a db instance using loki, I get an error saying that 'loki is not a constructor'.

var db = new loki('loki.json')

error : > Message: loki is not a constructor

Jafar Rasooli
  • 3,437
  • 2
  • 14
  • 13

1 Answers1

3

The library actually is not written with ES6 syntax. Simply import it as:

import loki from 'lokijs';

You can then use it like you have written in your question:

var db = new loki('loki.json');
Marc Scheib
  • 1,963
  • 1
  • 24
  • 29