Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'ɵcmp' of undefined #88

Open
csimpi opened this issue Jan 4, 2023 · 2 comments
Open

TypeError: Cannot read property 'ɵcmp' of undefined #88

csimpi opened this issue Jan 4, 2023 · 2 comments

Comments

@csimpi
Copy link

csimpi commented Jan 4, 2023

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

  • iOS/Android/Both: Android
  • iOS/Android versions: tested for Android 9-12
  • emulator or device. What type of device?: both, Pixel emulator and Samsung Note device

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

  • CLI: (run tns --version to fetch it): 8.3
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project): 8.3
  • Plugin(s): (look for the version numbers in the package.json file of your
    project and paste your dependencies and devDependencies here)

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)

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 is bugged

@triniwiz
Copy link
Owner

triniwiz commented Jan 5, 2023

The new package is @triniwiz/nativescript-image-cache-it this current package is only around for {N} v6 compat

@triniwiz
Copy link
Owner

triniwiz commented Jan 5, 2023

Just noticed you have the newer package you can by pass the need to import the module by adding the following to your main.ts

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

registerElement('ImageCacheIt', () => ImageCacheIt);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants