babel-loader icon indicating copy to clipboard operation
babel-loader copied to clipboard

$export is not a function. (In '$export($export.S + $export.F * !require(896 ), 'Object', { defineProperty: require(892 ).f })', '$export' is an instance of Object

Open iit2008047 opened this issue 5 years ago • 2 comments

when running the react native app on release (after bundling) I am facing a crash with following stack

$export is not a function. (In '$export($export.S + $export.F * !require(896             ), 'Object', { defineProperty: require(892           ).f })', '$export' is an instance of Object)
2019-03-26 16:24:15.825046+0530 Default[30104:5811597] Unhandled JS Exception: $export is not a function. (In '$export($export.S + $export.F * !require(896             ), 'Object', { defineProperty: require(892           ).f })', '$export' is an instance of Object)
2019-03-26 16:24:15.828938+0530 Default[30104:5811591] [] nw_socket_handle_socket_event [C3.1:1] Socket SO_ERROR [61: Connection refused]
2019-03-26 16:24:15.830763+0530 Default[30104:5811591] [] nw_socket_handle_socket_event [C3.2:1] Socket SO_ERROR [61: Connection refused]
2019-03-26 16:24:15.831784+0530 Default[30104:5811592] Module AppRegistry is not a registered callable module (calling runApplication)
2019-03-26 16:24:15.832275+0530 Default[30104:5811572] [] nw_connection_get_connected_socket [C3] Client called nw_connection_get_connected_socket on unconnected nw_connection
2019-03-26 16:24:15.832609+0530 Default[30104:5811572] TCP Conn 0x600003f2e940 Failed : error 0:61 [61]
2019-03-26 16:24:15.845630+0530 Default[30104:5811597] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: $export is not a function. (In '$export($export.S + $export.F * !require(896             ), 'Object', { defineProperty: require(892           ).f })', '$export' is an instance of Object)', reason: 'Unhandled JS Exception: $export is not a function. (In '$export($export.S +..., stack:

Babel Core Version: "babel-core": "^6.24.1",

My Babel RC

{
  "presets": [
    "react",
    "react-native"
  ],
  "plugins": [
    "transform-class-properties",
    "add-module-exports",
    "transform-decorators-legacy",
    "transform-flow-strip-types",
    "transform-exponentiation-operator"
  ]
}

Please tell us about your environment: react native

Current behavior: app crashing on launching the release bundle .. but in debug it works fine

iit2008047 avatar Mar 26 '19 11:03 iit2008047

Hey guys, Please help me out. I am stuck with the issue for some time now

Environment: OS: macOS 10.14 Node: 11.2.0 Yarn: 1.12.3 npm: 6.4.1 Watchman: 4.7.0 Xcode: Xcode 10.1 Build version 10B61 Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: 0.51.0 => 0.51.0

I am not updating my react native version. and my babel-core version is "[email protected]"

The issue is not in debug mode. Once I create the bundle and run it in release mode, app crashes with the exception.

thanks, cc: @kelset

iit2008047 avatar Mar 27 '19 05:03 iit2008047

Having a very similar issue, when trying to run some tests with jest.

The interesting thing is that for me this used to work, some package update (I am not exactly sure which/when) caused it to break.

 npm run test:unit

> [email protected] test:unit C:\dev\XYZImport
> vue-cli-service test:unit

FAIL tests/unit/TestComponentMounting.spec.js
  ● Test suite failed to run

    TypeError: $export is not a function

      at Object.<anonymous> (node_modules/core-js/library/modules/es6.object.define-property.js:6:1)
      at Object.<anonymous> (node_modules/core-js/library/fn/object/define-property.js:3:1)
      at Object.<anonymous> (node_modules/@babel/runtime-corejs2/core-js/object/define-property.js:3:18)
      at Object.<anonymous> (node_modules/core-js/library/modules/_object-dp.js:5:46)
      at Object.<anonymous> (node_modules/core-js/library/modules/_hide.js:3:10)
      at Object.<anonymous> (node_modules/core-js/library/modules/_export.js:9:12)
      at Object.<anonymous> (node_modules/core-js/library/modules/_iter-define.js:5:15)
      at Object.<anonymous> (node_modules/core-js/library/modules/es6.string.iterator.js:6:1)
      at Object.<anonymous> (node_modules/core-js/library/fn/promise.js:5:1)
      at Object.<anonymous> (node_modules/@babel/runtime-corejs2/core-js/promise.js:3:18)
      at Object.<anonymous> (node_modules/regenerator-runtime/runtime.js:5:39)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.747s

i3anaan avatar Apr 08 '19 09:04 i3anaan