Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Compatibility with Ivy #78

Open
adrogon opened this issue Apr 26, 2019 · 15 comments
Open

Compatibility with Ivy #78

adrogon opened this issue Apr 26, 2019 · 15 comments

Comments

@adrogon
Copy link

adrogon commented Apr 26, 2019

As explained here, the npm package currently does not run in Ivy due to CommonJS/UMD not supported.

Error: There is no format with import statements in '../node_modules/angular2-signaturepad' entry-point.

Would you please give a go at ng-packagr so that your npm package is compatible?

@adrogon
Copy link
Author

adrogon commented May 2, 2019

Looks like it'll be fixed by angular/angular#30200
You might still want to check ng-packagr and see if you like the output :)

@adrogon
Copy link
Author

adrogon commented May 28, 2019

Although angular/angular#30200 did not fix it, angular/angular#30591 should.

@adrogon
Copy link
Author

adrogon commented May 31, 2019

After applying upstream's change, we get the following message:

ERROR in Cannot read property 'getText' of null

Back to troubleshooting then.

@lespinosa
Copy link

Hi there! No one has a solution for this?

@koberleitner-hpg
Copy link

We ran into this as well after updating to Angular 9 with Ivy enabled. We were using the latest package available, 2.11.0. Everything was working fine before the upgrade, and we didn't change anything related to our components using SignaturePad. Debugging through our component, which we have setup according to the readme

@ViewChild(SignaturePad) signaturePad: SignaturePad;
ngAfterViewInit() {
    // this.signaturePad is now available
    this.signaturePad.set('minWidth', 5); // set szimek/signature_pad options at runtime
    this.signaturePad.clear(); // invoke functions from szimek/signature_pad API
}

in ngAfterViewInit, this.signaturePad is always undefined now, which seems to be the same problem previously reported.

I've done some light digging and don't see any obvious reason for this. I finally tried just embedding the complete code for signature-pad.ts into our app and using that component instead of the one from NPM and it works fine.

I'm not super familiar with how this project is being built for publishing to NPM but perhaps the package dependencies and or build tools need some updating in order for this to work with Ivy?

@adrogon
Copy link
Author

adrogon commented Mar 17, 2020

"angular2-signaturepad": "2.11.0" is dependent on "signature_pad": "2.3.2"

In package.json, we simply force the dependency:
"signature_pad": "3.0.0-beta.3"

And it works. I'm not sure about your exact issue, but give it a try :)

@koberleitner-hpg
Copy link

Thanks for the suggestion. I tried forcing that dependency but still get the same issue.

ERROR TypeError: Cannot read property 'set' of undefined
    at MyComponent.ngAfterViewInit (my.component.ts:72)

Curious how your solution fixes any issues. In using my own copied version of signature-pad.ts which works, I removed the reference to "angular2-signaturepad": "2.11.0" and replaced it with "signature_pad": "2.3.2" and everything seems to be working fine.

@joaqcid
Copy link

joaqcid commented Apr 11, 2020

for me the fix was changing the import of the component from
import { SignaturePad } from 'angular2-signaturepad/signature-pad';
to
import { SignaturePad } from 'angular2-signaturepad';

@AnthonyNahas
Copy link

@joaqcid Thank you!

Your suggestion fixed the problem

@KunalBurangi
Copy link

@joaqcid i tried this but it is saying that angular2-signaturepad has no exported member signaturePad

@joaqcid
Copy link

joaqcid commented Jul 7, 2020

@KunalBurangi hmm, weird

@avijitghosh700
Copy link

@joaqcid i tried this but it is saying that angular2-signaturepad has no exported member signaturePad

Same issue here

@joaqcid
Copy link

joaqcid commented Aug 1, 2020

this is what i have in my code import { SignaturePad } from 'angular2-signaturepad';

can you provide more information?

@fadia19
Copy link

fadia19 commented Aug 5, 2020

@joaqcid the fix didn't work for me as it still sees the signature pas as undefined. It says that it's not compatible with angular Ivy. Any recommendations ?

@joaqcid
Copy link

joaqcid commented Aug 5, 2020

do you see folder __ ivy... __ under node_modules/angular2-signaturepage

image

if not, you might need to run ngcc on your dependencies

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

No branches or pull requests

8 participants