Merott / nativescript-pdf-view

A basic PDF viewer plugin for NativeScript. Now maintained by @madmas: github.com/madmas/nativescript-pdf-view
Other
32 stars 35 forks source link

Runtime Typescript error occurs when running bundled source for iOS #8

Closed jboeijenga closed 7 years ago

jboeijenga commented 8 years ago

Hi @Merott ,

I'm trying this plugin for both iOS and Android to run and it works fine. Only after bundling the source I get a runtime error on iOS. This happens in the __extends method on the PDFViewDelegate class.

The error I get in the console is: JS ERROR TypeError: Attempted to assign to readonly property.

And it happens the following method on assigning the constructor: var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); };

When I remove this __extends method from the compiled js file it works fine. Also when not bundling source it works fine.

Do you have any idea how to get the plugin also working in bundled code?

Thanks!

update: I see Nativescript adds the noEmitHelpers option to their tsconfig. This prevents typescript from adding the __extends method to the compiled output.

Merott commented 7 years ago

@jboeijenga is this issue still there?

jboeijenga commented 7 years ago

As far as I know it is still there. We have forked this plugin to overcome this issue and to have support for xcode 8. Therefore we don't use this plugin anymore so I'm not really sure. But I don't expect t this issue to be gone.

Merott commented 7 years ago

OK - I'll get this issue resolved.

The Xcode 8 compatibility should be resolved already.

Thanks.

Merott commented 7 years ago

I believe any webpack bundling issues should be resolved in the just released version 2.