triniwiz / nativescript-plugins

Apache License 2.0
78 stars 50 forks source link

[nativescript-image-cache-it] TypeError: Cannot read property 'ɵcmp' of undefined #160

Open csimpi opened 1 year ago

csimpi commented 1 year ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

I upgraded to NativeScript 8.3 from 8.2, and since that, I am getting this error every time when image-cache-it is in use:

  JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'ɵcmp' of undefined
  JS: TypeError: Cannot read property 'ɵcmp' of undefined
  JS:     at getComponentDef (file: src/webpack:/app/node_modules/@angular/core/fesm2015/core.js:1121:0)
  JS:     at extractDirectiveDef (file: src/webpack:/app/node_modules/@angular/core/fesm2015/core.js:945:0)
  JS:     at Array.map (<anonymous>)
  JS:     at def.directiveDefs (file: src/webpack:/app/node_modules/@angular/core/fesm2015/core.js:922:0)
  JS:     at createTView (file: src/webpack:/app/node_modules/@angular/core/fesm2015/core.js:9823:0)
  JS:     at getOrCreateTComponentView (file: src/webpack:/app/node_modules/@angular/core/fesm2015/core.js:9771:0)
  JS:     at addComponentLogic (file: src/webpack:/app/node_modules/@angular/core/fesm2015/core.js:10542:0)
  JS:     at instantiateAllDirectives (file: src/webpack:/app/node_modules/@angular/core/fesm2015/core.js:10383:0)

If I delete <ImageCacheIt .....></ImageCacheIt> from the template, this error doesn't appear and the app works as expected.

I am on Angular 12 because NS has routing issues with Angular 13/14. I can't install the latest version of your plugin because it requires Angular 14 :/

UPDATE: I found a clue:

export 'ImageCacheItDirective' (imported as 'i1') was not found in '@triniwiz/nativescript-image-cache-it/angular' (possible exports: ImageCacheItModule, ɵa)

this doesn't appear when I use the latest version, but since it requires Angular 14 that breaks NS + Angular routing this plugin seems bugged with NS 8.3 + Angular 12

csimpi commented 1 year ago

@triniwiz I can see that the questions are unanswered, is this repo abandoned?

triniwiz commented 1 year ago

No just maintaining multiple things ...

Sharing the answer here again

import { ImageCacheIt } from '@triniwiz/nativescript-image-cache-it';
import { registerElement } from '@nativescript/angular';

registerElement('ImageCacheIt', () => ImageCacheIt);
csimpi commented 1 year ago

I understand, and thank you for your help!