0

I've a sample Angular app built with version 12. When this app try to use a library built with Angular 10 and compile the code I get below compilation error. Any help on this is appreciated. This is part of a POC on an app using libraries built with older versions as our application is expected to be in this state eventually.

Error: node_modules/practice10/lib/practice10lib.module.d.ts:5:21 - error TS2694: Namespace '"C:/src/spaexample/axcess-spa-mainapp/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDefWithMeta'.

5 static ɵmod: i0.ɵɵNgModuleDefWithMeta<Practice10libModule, [typeof i1.Practice10libComponent], [typeof i2.AgGridModule], [typeof i1.Practice10libComponent]>; ~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/practice10/lib/practice10lib.service.d.ts:4:21 - error TS2694: Namespace '"C:/src/spaexample/axcess-spa-mainapp/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDef'.

4 static ɵfac: i0.ɵɵFactoryDef<Practice10libService, never>; ~~~~~~~~~~~~

mError: node_modules/practice10/lib/practice10lib.service.d.ts:5:22 - error TS2724: '"C:/src/spaexample/axcess-spa-mainapp/node_modules/@angular/core/core"' has no exported member named 'ɵɵInjectableDef'. Did you mean 'ɵgetInjectableDef'?

5 static ɵprov: i0.ɵɵInjectableDef;

Patri
  • 3
  • 4
  • Did you try removing your node_modules folder and npm install again? – Anglesvar Oct 20 '21 at 18:08
  • @Anglesvar - I've tried that multiple times but that did not help - in our application we have one integrator app consumes libraries from four (4) different products. And these four products can be on different angular versions My question is - if the integrator app is on latest Angular version (v 12) and one of the product is older Angular version ( v 10), and when I build the integrator app I get compilator errors listed in this post. Is it possible for a SPA based application to have a main app on latest Angular and libraries be on older version? – Patri Oct 20 '21 at 18:35
  • .. try, maybe, compile with 'Ivy' disabled .. – Vovan_Super Oct 20 '21 at 19:01
  • I would recommend to have the versions as similar as possible. Try this https://stackoverflow.com/questions/58078033/ng-serve-throwing-angular-core-core-has-no-exported-member-eefactorydef . This might work. – Anglesvar Oct 20 '21 at 19:20
  • The other post do not answer my question...Yeah, if app and libraries are on same version then there no issues. But our application is massive and we expect that libraries will be on different versions unless Angular does not support and there is no solution for the problem I stated.. – Patri Oct 20 '21 at 20:27

0 Answers0