angular: Ivy error TS-996002, when using compiled esm5 files

🐞 bug report

Affected Package

The issue is caused by package @angular/cli

Is this a regression?

It only happens when Ivy is enabled - ngcc. With stable ngc AOT build it works fine.

Description

The error occurs when running the ng build command, if the source code imports a module and component from a compiled esm5 file, which has the associated d.ts and metadata.json files.

πŸ”¬ Minimal Reproduction

Can be found here: https://github.com/acidb/mobiscroll-ivy-test Running ng build throws the mentioned error.

πŸ”₯ Exception or Error


ERROR in src/mobiscroll/src/js/input.angular.d.ts:3:22 - error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

3 export declare class MbscInputModule {

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.0-next.0
Node: 12.4.0
OS: win32 x64
Angular: 9.0.0-next.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-next.0
@angular-devkit/build-angular     0.900.0-next.0
@angular-devkit/build-optimizer   0.900.0-next.0
@angular-devkit/build-webpack     0.900.0-next.0
@angular-devkit/core              9.0.0-next.0
@angular-devkit/schematics        9.0.0-next.0
@angular/cli                      9.0.0-next.0
@ngtools/webpack                  9.0.0-next.0
@schematics/angular               9.0.0-next.0
@schematics/update                0.900.0-next.0
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?

Found this issue with the same error message, which is closed and fixed, but I’m not sure if it’s the same cause.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 18 (7 by maintainers)

Most upvoted comments

@dioslaska - you’ll be glad to hear that after https://github.com/angular/angular/pull/34254 lands your test reproduction will build without error! See https://github.com/acidb/mobiscroll-ivy-test/pull/1/files

Created a reproduction repo with the minified fesm5 file: https://github.com/acidb/mobiscroll-ivy-test/tree/test