trekhleb / angular-library-seed

🌾 Seed project for Angular libraries that are AOT/JIT compatible and that use external SCSS-styles and HTML-templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo project's failing after upgrading all `@angular/*` packages to `^5.0.3`

Kamilius opened this issue · comments

After upgrade of all @angular related packages to v5.0.3, demo project started to throw following error into dev tools console:
Uncaught Error: Unexpected value '[object Object]' imported by the module 'AppModule'. Please add a @NgModule annotation.

[object Object] is basically return of .forRoot() method, of library's root module, AppModule is a demo app root module.

Any ideas on how to deal with this?

Hi @Kamilius ,
I share the same kind of issue than you. Currently I got a solution by using the following cmd:

  • ng build --preserve-symlinks
    But when you want to build the production (-prod), you will probably fail with the error:
    Calling function 'Kng2CoreModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule
    To avoid this error the solution is to force the JIT only compilation (avoiding AOT):
  • ng build --preserve-symlinks --aot=false -prod
    But of course it's not a solution because AOT is much more efficient.

I'm also looking for a better clean solution 🚒