You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Please add a @NgModule annotation." error with AOT, full path vs short package.json main #6239
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
The log given by the failure.
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
changed the title [-]"Please add a @NgModule annotation." error with AOT, full path vs short packa.json `main`[/-][+]"Please add a @NgModule annotation." error with AOT, full path vs short package.json `main`[/+]on May 9, 2017
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 angular/angular#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?
Reacted by Oleksandr Hutsulyak, Gaétan Collaud, monnef, Dessalines, Scott McMaster, Eric Kucks, ropstah and Anjil Dhamala
angular-automatic-lock-bot commented on Sep 7, 2019
Activity
[-]"Please add a @NgModule annotation." error with AOT, full path vs short packa.json `main`[/-][+]"Please add a @NgModule annotation." error with AOT, full path vs short package.json `main`[/+]filipesilva commentedon May 10, 2017
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 angular/angular#16486
tmakuch commentedon May 14, 2017
@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.
pro-soochee commentedon Nov 20, 2017
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?
angular-automatic-lock-bot commentedon Sep 7, 2019
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.