angular2-signaturepad icon indicating copy to clipboard operation
angular2-signaturepad copied to clipboard

Compatibility with Ivy

Open adrogon opened this issue 6 years ago • 15 comments

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 avatar Apr 26 '19 16:04 adrogon

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

adrogon avatar May 02 '19 09:05 adrogon

Although https://github.com/angular/angular/pull/30200 did not fix it, https://github.com/angular/angular/pull/30591 should.

adrogon avatar May 28 '19 10:05 adrogon

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

ERROR in Cannot read property 'getText' of null

Back to troubleshooting then.

adrogon avatar May 31 '19 10:05 adrogon

Hi there! No one has a solution for this?

lespinosa avatar Sep 11 '19 22:09 lespinosa

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?

koberleitner-hpg avatar Mar 17 '20 16:03 koberleitner-hpg

"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 :)

adrogon avatar Mar 17 '20 16:03 adrogon

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.

koberleitner-hpg avatar Mar 17 '20 18:03 koberleitner-hpg

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';

joaqcid avatar Apr 11 '20 16:04 joaqcid

@joaqcid Thank you!

Your suggestion fixed the problem

AnthonyNahas avatar Apr 14 '20 13:04 AnthonyNahas

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

KunalBurangi avatar Jul 07 '20 15:07 KunalBurangi

@KunalBurangi hmm, weird

joaqcid avatar Jul 07 '20 15:07 joaqcid

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

Same issue here

avijitghosh700 avatar Aug 01 '20 10:08 avijitghosh700

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

can you provide more information?

joaqcid avatar Aug 01 '20 11:08 joaqcid

@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 ?

fadia19 avatar Aug 05 '20 05:08 fadia19

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

image

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

joaqcid avatar Aug 05 '20 11:08 joaqcid