ember octane tutorial. using: ember generate model person creates a build error when used for person model (and any other model for that matter).
I was looking at the ember octane tutorial and generated the person model. The generated code included code that significantly differs from the example. This extra code causes build errors.
This is after I run
"ember generate model person"
import DS from 'ember-data';
const { Model } = DS;
export default Model.extend({
});
This is the example from https://octane-guides-preview.emberjs.com/release/models/
import DS from 'ember-data';
const { Model, attr } = DS;
export default class Person extends Model {
@attr('string') firstName;
@attr('date') birthday;
}
If I added the @attr code to the generated model, I get this build error.
testapp/models/person.js: Unexpected token, expected "," (5:27)
3 |
4 | export default class Person extends Model ({
5 | @attr('string') firstName;
| ^
6 | @attr('date') birthday;
7 | });
The issue was that the generated model includes a few things that the example does not.
export default Model.extend({
instead of
export default class Person extends Model {
I expected a clean build as I used the ember generate model method and added the pieces for the attr as per example.
I think the ember generated model blueprint needs updating for Octane?
I would also suggest the blueprint adds the 'class extends Model' as well?
Aucun commentaire:
Enregistrer un commentaire