Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Ionic build with AOT, the relation between entities will not be recognized. #26

Open
JeongJun-Lee opened this issue Jul 27, 2018 · 0 comments

Comments

@JeongJun-Lee
Copy link

JeongJun-Lee commented Jul 27, 2018

When Ionic build with option like --prod or --aot, it'll pass AOT process. But when App is started, it emits not defined reference error at 31 lines like below.

[Versions]
Angular: 5.2.11
ionic-angular: 3.9.2
ionic/app-script: 3.1.9
typeorm: 0.2.7

[Entity: categories.ts]
`
@entity("Categories")
@Index("fk_Categories_Categories1_idx",["Categories_id",])
export class Categories {

@PrimaryGeneratedColumn({
    name:"id"
    })
id:number;
    

@Column("varchar",{ 
    nullable:false,
    length:45,
    name:"name"
    })
name:string;
    

@Column("boolean",{ 
    nullable:true,
    name:"isInactive"
    })
isInactive:boolean;

31: @manytoone(type=>Categories, Categories_id=>Categories_id.subCategories)
@joincolumn({ name:'Categories_id'})
Categories_id:Categories;

@OneToMany(type=>Categories, categories=>categories.Categories_id)
subCategories:Categories[];



@OneToMany(type=>Products, products=>products.Categories_id)
products:Products[];

}
`

[Error]
ore.js:1449 ERROR Error: Uncaught (in promise): ReferenceError: Categories_1 is not defined
ReferenceError: Categories_1 is not defined
at Object.ɵ0 [as type] (categories.ts:31)
at new RelationMetadata (RelationMetadata.js:138)
at EntityMetadataBuilder.js:338
at Array.map ()
at EntityMetadataBuilder.computeEntityMetadataStep1 (EntityMetadataBuilder.js:334)
at EntityMetadataBuilder.js:68
at Array.forEach ()
at EntityMetadataBuilder.build (EntityMetadataBuilder.js:68)
at ConnectionMetadataBuilder.buildEntityMetadatas (ConnectionMetadataBuilder.js:56)
at Connection.buildMetadatas (Connection.js:509)
at Object.ɵ0 [as type] (categories.ts:31)
at new RelationMetadata (RelationMetadata.js:138)
at EntityMetadataBuilder.js:338
at Array.map ()
at EntityMetadataBuilder.computeEntityMetadataStep1 (EntityMetadataBuilder.js:334)
at EntityMetadataBuilder.js:68
at Array.forEach ()
at EntityMetadataBuilder.build (EntityMetadataBuilder.js:68)
at ConnectionMetadataBuilder.buildEntityMetadatas (ConnectionMetadataBuilder.js:56)
at Connection.buildMetadatas (Connection.js:509)
at c (polyfills.js:3)
at polyfills.js:3
at polyfills.js:3
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4760)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant