angular2-flash-messages icon indicating copy to clipboard operation
angular2-flash-messages copied to clipboard

unable to build using prod

Open gemal opened this issue 8 years ago • 9 comments

when I try to use --aot to build a project with FlashMessagesModule I get an error

ERROR in Error: Unexpected value ‘FlashMessagesModule in x/node_modules/angular2-flash-messages/module/module.d.ts’ imported by the module ‘AppModule in x/src/app/app.module.ts’. Please add a @NgModule annotation.

does FlashMessagesModule not work with aot yet?

gemal avatar Nov 27 '17 10:11 gemal

The problem is, that there are no ngc metadatas, that are requiered for the usage with --aot or --prod.

Dinistro avatar Nov 27 '17 13:11 Dinistro

is that something that the angular2-flash-messages should provide or?

gemal avatar Nov 27 '17 13:11 gemal

@gemal I think so. Anyway I got a same problem. I use angular version 5 and angular2-flash-messages version 2.0.0

peymannj avatar Nov 27 '17 13:11 peymannj

@gemal Yeah, they need to kick the ngc (angular compiler) and provide the generated metadata for the angular-cli.

Dinistro avatar Nov 27 '17 13:11 Dinistro

@gemal , @peymannj published updated package. Please update and let me know if problem still persists.

moff avatar Nov 27 '17 18:11 moff

@moff I updated to 2.0.1 and also I removed forRoot() function. Now I get new error message :

ERROR in Error: Error encountered resolving symbol values statically. Could not resolve @angular/core relative to D:/Project/node_modules/angular2-flash-messages/module/module.d.ts., resolving symbol FlashMessagesModule in D:/Project/node_modules/angular2-flash-messages/module/module.d.ts, resolving symbol FlashMessagesModule in D:/Project/node_modules/angular2-flash-messages/module/module.d.ts

I have this error when I run "ng build --prod"

peymannj avatar Nov 27 '17 18:11 peymannj

@gemal , @peymannj Hm, I think this problem has something to do with this https://github.com/angular/angular-cli/issues/4647

moff avatar Nov 27 '17 19:11 moff

@gemal , @peymannj check this comment https://github.com/angular/angular-cli/issues/4647#issuecomment-305967234

moff avatar Nov 27 '17 19:11 moff

Thank you so much. The answer in the link works !

Specifying paths to @angular inside AngularCLI's tsconfig.json prevented the error from happening. "paths": { "@angular/*": ["../node_modules/@angular/*"] }

peymannj avatar Nov 27 '17 19:11 peymannj