--aot : "Unexpected Value in imported module. Please add a @NgModule annotation"
π Bug report
Command (mark with an x)
- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, the previous version in which this bug was not present was: v 5.2.11Description
Application serves well when --aot is not enabled. But on enabling aot, the compiler seems to throw an error requesting to add the @NgModule annotation. The issue seems to point out to one of the external modules imported.
π¬ Minimal Reproduction
Have Created a GitHub repository for minimal reproduction of the issue.
- Clone the repository from https://github.com/AntonyJos/angularIssue.git
- Run
npm install - Execute
ng serve. Navigate to http://localhost:4200/. Everything works fine. - Execute
ng serve --aot. - Application Fails to compile
Expecting the application to be compiled successfully as was the case with JIT
π₯ Exception or Error
ERROR in : Unexpected value 'Module name in D:/angularIssue/node_modules/....d.ts' imported by the module 'AppModule in D:/angularIssue/src/app/app.module.ts'. Please add a @NgModule annotation.
π Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.1.3
Node: 10.16.3
OS: win32 x64
Angular: 8.1.3
... cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.3
@angular-devkit/build-angular 0.801.3
@angular-devkit/build-optimizer 0.801.3
@angular-devkit/build-webpack 0.801.3
@angular-devkit/core 8.1.3
@angular-devkit/schematics 8.1.3
@ngtools/webpack 8.1.3
@schematics/angular 8.1.3
@schematics/update 0.801.3
rxjs 6.5.3
typescript 3.4.5
webpack 4.35.2
Hi, this seems to be caused by @kyma which is not packaged properly and doesn't confirm with the APF spec. Also, it includes direct dependencies instead of peerDependencies on @angular/ packages which is discouraged as the library can get a different Angular module instead, which would cause your application to break.
More details on how to create a library can be found here: https://angular.io/guide/creating-libraries https://angular.io/guide/creating-libraries#use-typescript-path-mapping-for-peer-dependencies
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.