PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
83 stars 28 forks source link

The plugin has a problem with webpack #4

Closed ignaciolarranaga closed 7 years ago

ignaciolarranaga commented 7 years ago

When I introduce webpack on my project it raises an exception on webpack execution:

Project successfully built
Successfully deployed on device with identifier '00A4117D-42D7-4D34-A741-4D4FAA4286CD'.
Oct 19 20:58:29 MacBook-Pro-de-Ignacio gyntoclient[46562]: 1   0x1119238d7 -[TNSRuntime executeModule:]
Oct 19 20:58:29 MacBook-Pro-de-Ignacio gyntoclient[46562]: 2   0x10e9f61b2 main
Oct 19 20:58:29 MacBook-Pro-de-Ignacio gyntoclient[46562]: 3   0x11425b92d start
Oct 19 20:58:29 MacBook-Pro-de-Ignacio gyntoclient[46562]: file:///app/bundle.js:132081:26: JS ERROR TypeError: Attempted to assign to readonly property.
Oct 19 20:58:29 MacBook-Pro-de-Ignacio com.apple.CoreSimulator.SimDevice.00A4117D-42D7-4D34-A741-4D4FAA4286CD.launchd_sim[5678] (UIKitApplication:com.gynto.client[0x564f][46562]): Service exited due to signal: Segmentation fault: 11

And this line is: function __() { this.constructor = d; }

Here is a section of the webpack bundle:

/*!**************************************************!*\
  !*** ../~/nativescript-purchase/purchase.ios.js ***!
  \**************************************************/
/***/ function(module, exports, __webpack_require__) {

    /*! *****************************************************************************
    Copyright (c) 2016 Tangra Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    ***************************************************************************** */
    "use strict";
    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 __());
    };

Removing "use strict"; seems to solve the problem as per @hdeshev on here NativeScript/nativescript-geolocation#32, but this is not the underlying problem I guess.

The sample problem arose also:

PeterStaev commented 7 years ago

Hey @ignaciolarranaga , actually I think the problem is not the use strict statement but the helper functions (__extends) as i had similar complains with the DropDown.

I've published a new version to npm removing the the helpers. Can you please try and see if it will work. If it does not i will also see to remove the strict statements.

ignaciolarranaga commented 7 years ago

Hey @PeterStaev it does work, thank you!