-
Notifications
You must be signed in to change notification settings - Fork 93
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
Error: Unexpected value 'ToasterModule' imported by the module 'AppModule' #55
Comments
Could you please provide more context around this error or a working, reproducible example? Thanks |
Can confirm this one. I have the same issue when I try to compile my project using AoT compilation. It seems Angular2-Toaster currently doesnt support AoT compiling. I'm not exactly sure why though.. will keep digging :) |
I managed to get it to build by importing the source as in: So there seems to be something wrong with how the module is bundled that causes it to not get imported correctly by |
@dagstuan Thanks for the confirmation and the investigative work. I'll look into it. |
I am also having trouble with lazy-loaded routes but the error may point to the problem...
Looking at the code it looks like ToasterModule is importing BrowserModule where it probably should be importing CommonModule... |
@jcannata That is a really good catch. I didn't notice that BrowserModule was used during the code review for the ngModule contribution. In hindsight, it makes perfect sense that this would be causing issues, since BrowserModule is needed for the entrance to the application, whereas CommonModule is needed for bootstrapping a plugin, which is what this is. The library will always be dropped into another application for consumption. I'll take a close look at this locally. Thanks. |
Removed BrowserModule and replaced it with CommonModule in toaster.module.ts, since the toaster module should ALWAYS be loaded in the context of a calling application, relying on external bootstrapping. Potential fix for #55. Updated dependencies order for Travis-CI build.
Is anyone able to confirm via getting latest source (not package) that the above commit has resolved this issue? I'd love confirmation before pushing a new npm package version. Thanks. |
I have forked your code, 'link'ed it locally and confirmed that it solves the issue. |
This is now published to NPM as |
When compiling with @Angular/Compiler-cli it throws Error: Unexpected value 'ToasterModule' imported by the module 'AppModule'
Angular 2 RC6
ngc -p tsconfig.json
The text was updated successfully, but these errors were encountered: