Thursday 13 April 2017

angular module as npm library

Hello really simple question from my side.

Anyone know if there is any update on this article: http://blog.angular-university.io/how-to-create-an-angular-2-library-and-how-to-consume-it-jspm-vs-webpack/ ?

I would like to create angular module as library, and lazy-load it in another project.

Any suggestions?

webpack-dev-server runs correctly with given library, but I got issues when trying to run AOT or JIT compilers:

AOT:

Error: Unexpected value 'HelloWorld in /path_to_my_project/admin-frontend/node_modules/angular2-library-example/lib/HelloWorld.d.ts' declared by the module 'AppModule in /path_to_my_project/admin-frontend/src/app/app.module.ts'. Please add a @Pipe/@Directive/@Component annotation.

JIT:

ERROR in 0.5d3d603e9aaf0663af2c.chunk.js from UglifyJs
Unexpected token: name (HelloWorld) [0.5d3d603e9aaf0663af2c.chunk.js:173,4]

I am using AngularClass webpack starter as boilerplate: https://github.com/AngularClass/angular2-webpack-starter (I have updated all @angular dependencies to 4.0.1)



via Maciej Sobala

No comments:

Post a Comment