Reputation: 9643
I'm trying to start a server from a repo but having issues getting it started because of the following error:
ember serve
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
mirage/factories/page.js: line 4, col 42, 'faker' is not defined.
1 error
mirage/scenarios/default.js: line 7, col 19, 'domain' is defined but never used.
mirage/scenarios/default.js: line 13, col 105, Missing semicolon.
mirage/scenarios/default.js: line 5, col 7, 'ads' is defined but never used.
3 errors
===== 2 JSHint Errors
page.js:
import { Factory } from 'ember-cli-mirage';
export default Factory.extend({
permalink: function() { return '/' + faker.lorem.words(1); }
});
What is wrong here? I also manually installed faker using npm but it doesn't seem to have any effect at all and I'm still stuck with this error.
Upvotes: 0
Views: 2139
Reputation: 1434
faker
should be included in the ember-cli-mirage
namespace, so just import it along with Factory
:
import { Factory, faker } from 'ember-cli-mirage';
Upvotes: 1
Reputation: 14943
faker is not defined, so the code should have either one of these:
import { Factory } from 'ember-cli-mirage';
let faker = {
lorem: {
words: function() {}
}
};
or
import { Factory } from 'ember-cli-mirage';
import faker from 'faker-module-in-the-repo-maybe';
Upvotes: 0