Skip to content

"Please add a @NgModule annotation." error with AOT, full path vs short package.json main #6239

@FriOne

Description

@FriOne

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

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.

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions