x)- [x] bug report -> please search issues before submitting
- [ ] feature request
Windows 7
@angular/cli: 1.0.2
node: 6.9.0
os: win32 x64
@angular/common: 4.1.1
@angular/compiler: 4.1.1
@angular/core: 4.1.1
@angular/forms: 4.1.1
@angular/http: 4.1.1
@angular/platform-browser: 4.1.1
@angular/platform-browser-dynamic: 4.1.1
@angular/router: 4.1.1
@angular/cli: 1.0.2
@angular/compiler-cli: 4.1.1
ng serve works ok, but aot compilation fails in case:
import module like import { Ng2FlatpickrModule } from 'ng2-flatpickr/lib/ng2-flatpickr.module.js';
-> No errors
import module like import { Ng2FlatpickrModule } from 'ng2-flatpickr;
-> "Please add a @NgModule annotation." error
ERROR in Unexpected value 'Ng2FlatpickrModule in .../node_modules/ng2-flatpickr/lib/ng2-flatpickr.module.js' imported by the module 'AppModule in .../src/app/app.module.t
s'. Please add a @NgModule annotation.ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'D:\Projects\work\unleesh-frontend\src'
@ ./src/main.ts 6:0-74
@ multi ./src/main.ts
There should be no errors
Here is my fork https://github.com/FriOne/ng2-flatpickr
This really sounds like a problem with how that library is published. We don't yet have a full guide for how to do it, but there's WIP version that you can direct the author to in https://github.com/angular/angular/pull/16486
@filipesilva, did you worked with webpack to create the lib. I see that you're using rollup to bundle your code in your lib quickstart.
I'm facing missing NgModule annotation issue in my custom library and I'm trying to debug what is the root case. As far as I understood the issue is that awsome-typescript-loader/ts-loader for webpack does not parse the code compiler-friendly - the module is exported with all the required properties, but it's not exported as a NgModule object. Thus the compiler fails to load the exported module as it does the typecheking expecting instance of NgModule.
Currently I want to check @ngTools/webpack or ngc (either vanilla or throught ngc-webpack). You are using ngc, what would confirm my theory.
Facing same issue,
ERROR in Error: Unexpected value 'JSONEditorModule in /node_modules/ng2-jsoneditor/dist/ng2-jsoneditor.d.ts' imported by the module 'AppModule in /src/app/app.module.ts'. Please add a @NgModule annotation.
This is a third-party library and there is no annotation for module or component. How would I update that library? or is there any other way to add the annotation for that module?
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Facing same issue,
ERROR in Error: Unexpected value 'JSONEditorModule in /node_modules/ng2-jsoneditor/dist/ng2-jsoneditor.d.ts' imported by the module 'AppModule in /src/app/app.module.ts'. Please add a @NgModule annotation.This is a third-party library and there is no annotation for module or component. How would I update that library? or is there any other way to add the annotation for that module?