-
Notifications
You must be signed in to change notification settings - Fork 12k
"Please add a @NgModule annotation." error with AOT, full path vs short package.json main
#6239
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
Comments
main
main
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, 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. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
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
Repro steps.
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.
Desired functionality.
There should be no errors
Mention any other details that might be useful.
Here is my fork https://github.com/FriOne/ng2-flatpickr
The text was updated successfully, but these errors were encountered: