Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Maximum call stack size exceeded" in bundle caused by babelHelpers #20476

Closed
2 of 3 tasks
MarkOSullivan94 opened this issue Jul 31, 2018 · 5 comments
Closed
2 of 3 tasks
Labels
Platform: Linux Building on Linux. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@MarkOSullivan94
Copy link

MarkOSullivan94 commented Jul 31, 2018

Environment

Environment:
OS: Linux 4.4
Node: 9.4.0
Yarn: Not Found
npm: 6.2.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.3.1 => 16.4.0
react-native: ^0.55.4 => 0.55.4

Description

Currently trying to produce a bundle for both our Android and iOS applications so we can release internal test builds before releasing a new update to our apps in the store.

The bundle is produced fine however error messages appear whenever trying to use any RN component in our Android / iOS apps.

**iOS error message **

image from ios

Android error message

screenshot_1532077038

Line 1214 of the android bundle shows this line

return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== (typeof Symbol === "function" ? Symbol.prototype : "@@prototype") ? "symbol" : typeof obj === "undefined" ? "undefined" : babelHelpers.typeof(obj);

Which is apart of the following code block.

var babelHelpers = global.babelHelpers = {};
 babelHelpers.typeof = typeof Symbol === "function" && babelHelpers.typeof(typeof Symbol === "function" ? Symbol.iterator : "@@iterator") === "symbol" ? function (obj) {
   return typeof obj === "undefined" ? "undefined" : babelHelpers.typeof(obj);
 } : function (obj) {
   return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== (typeof Symbol === "function" ? Symbol.prototype : "@@prototype") ? "symbol" : typeof obj === "undefined" ? "undefined" : babelHelpers.typeof(obj);
 };

I've managed to locate whenever this error starting appearing in our earlier commits and the only way I was successful in getting rid of it was by removing our .babelrc config and updating our paths so they're using relative paths and not absolute paths (using the alias in the .babelrc config).

Ideally we want to use the alias as it makes it a lot easier whenever moving files in the project and also easier for testing.

I've seen two similar issues already having been posted. Neither of which offers an insightful solution.

#19620
#19788

In case it helps here is both our .babelrc file and package.json

.babelrc

{
  "presets": ["env", "react", "react-native"],
  "plugins": [
    ["module-resolver", {
      "root": ["./reactediting"],
      "alias": {
        "common": "./src/common",
        "editing": "./src/editing",
        "medals": "./src/medals",
        "mybag": "./src/mybag",
        "assets": "./assets/",
        "testModels": "./__test__/models"
      }
    }]
  ]
}

package.json

{
  "name": "ShotScopeRN",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "rnpm": {
    "assets": [
      "../../app/src/main/assets/fonts/"
    ]
  },
  "dependencies": {
    "babel": "^6.23.0",
    "babel-plugin-module-resolver": "^3.1.1",
    "es6-symbol": "^3.1.1",
    "lodash": "^4.17.10",
    "react": "^16.3.1",
    "react-dom": "^16.4.1",
    "react-native": "^0.55.4",
    "react-native-animatable": "^1.2.4",
    "react-native-check-box": "^2.1.0",
    "react-native-image-crop-picker": "^0.20.1",
    "react-native-maps": "^0.21.0",
    "react-native-share": "^1.0.27",
    "react-native-social-share": "^1.5.0",
    "react-native-sortable-list": "0.0.20",
    "react-native-svg": "^6.2.2",
    "react-native-text": "0.0.7",
    "react-native-view-shot": "^2.3.0",
    "react-redux": "^5.0.6",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0",
    "rn-viewpager": "^1.2.9",
    "spherical-geometry-js": "^1.0.1",
    "svgr": "^1.8.1"
  },
  "devDependencies": {
    "@babel/preset-env": "^7.0.0-beta.49",
    "babel-core": "^6.26.3",
    "babel-jest": "^23.0.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "jest": "^23.0.1",
    "jest-cli": "^23.0.1",
    "jsdom": "^11.11.0",
    "redux-mock-store": "^1.5.1",
    "regenerator-runtime": "^0.11.1"
  }
}
@MarkOSullivan94
Copy link
Author

@loganfsmyth pinging you in case you or if you would know any babel maintainer who could provide some help with this

@loganfsmyth
Copy link

That sounds like the helper transform is being run on the file containing all the helpers, but I have no idea how RN works or why that would be.

@react-native-bot
Copy link
Collaborator

Have you been able to reproduce this on the latest release, 0.56?

@MarkOSullivan94
Copy link
Author

Yes. I upgraded to 0.56 and had the same issue.

@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label Aug 18, 2018
@react-native-bot
Copy link
Collaborator

I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@facebook facebook locked as resolved and limited conversation to collaborators Aug 18, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Linux Building on Linux. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants