-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Metro Bundler] Maximum call stack size exceeded (when upgrading to 0.50.1) #16689
Comments
this is happening on android |
this is happening on node 6 and also node 8 with android and ios with react-native 50 and also 50.1 |
Also seeing this 😕 |
Setting the |
@adbl can you share your deps? |
I took the time to uninstall pretty much every package in my large project until I was left with the following:
(I also poly-filled the missing imports) What's unusual is that I also tried a Anyways, I'll be sticking to 0.49.5 for the time being until I can find out why this is happening. |
I think that I may have found the problem. One of my unused recursive functions in the project seem to be causing the bundling error. The unusual thing I found is that if the function was called it would bundle correctly. Otherwise there's a stack overflow. This only affects non-dev bundles. function isFirstChild(parentNode, childNode) {
if (!parentNode || !childNode || !parentNode.children || !parentNode.children.length === 0) return false;
if (parentNode.children[0] === childNode) return true;
return isFirstChild(parentNode.children[0], childNode);
} Also changing the function to a const arrow function seems to work. const isFirstChild = (parentNode, childNode) => {
if (!parentNode || !childNode || !parentNode.children || !parentNode.children.length === 0) return false;
if (parentNode.children[0] === childNode) return true;
return isFirstChild(parentNode.children[0], childNode);
} So my theory is that updates to the metro bundler cli between react-native 0.49.5 and 0.50.1 now cause stack overflows when bundling files that contain an unreferenced recursive function. |
@jamsch I have been struggling with this issue too now for quite some time. How were you able to point the problem to this little function? Btw, it took me like two hours to figure out out that setting |
@adbl I started adding/removing module includes starting from the app root until I narrowed down a specific file. Even though it bundles successfully, the app unfortunately now instantly crashes in production mode, while dev mode is still fine. I can't tell what's wrong because obviously the bundle is minified and I'm left with the error:
I'll be sticking with 0.49.5 for now. |
Yeah, I'm about to give up for now too. I suspect it could be related to minification and saw this commit which could be related: facebook/metro@367a5f5 |
Ok, so in our case when I comment out everything from |
Yep, here is the code causing trouble in ex-navigation:
Which is referenced conditionally only if And yes, the bundle doesn't fail if changing it to:
|
Going a bit deeper, I now have a minified production jsbundle which crashes inside what I think is minified regenerator-runtime:
the crashing minified code is:
I think this is here: https://github.com/facebook/regenerator/blob/9b6ebc0532ff373e06e3421b26800ac8979913d3/packages/regenerator-runtime/runtime.js#L300 Shouln't more people have this problem, I thought async/await was used widely by now? |
I am also seeing issues when trying to get a production build with |
Trying previous versions of metro-bundler. I think this commit is causing all the trouble: facebook/metro@ad927b9#diff-126ae02fbbc88cd17236fb9fc425c6e5 upgrading to uglify-es. Here is an uglify bug which coule be the one causing the bundling issues described initially: mishoo/UglifyJS#2442 Let me know if there is anything else I can to, we are depending on v0.50.1 to fix iPhone X support in our app (SafeAreaView). |
Wohoo, I hacked yarn.lock to make metro-bundler use |
@adbl great work, could you share you small fix? |
@sibelius so in yarn.lock, should say:
rather than 3.1.7, but I also installed uglify-es manually first and messed around in node_modules to actually make it so. I think if you change this in yarn.lock and |
@adbl you could also use yarns resolutions in your package json "resolutions": {
"uglify-es": "3.1.8"
} I did that after seeing your comment that the problem was uglify-es |
Summary: **Summary** Minification fails or minified bundle may crash due to uglify-es bugs which have been fixed recently. See facebook/react-native#16689 **Test plan** Try to production bundle a project using ex-navigation, which fails with: ``` Maximum call stack size exceeded ``` Use this patch and see that bundling suceeds. There are also minified runtime errors solved by this change, see facebook/react-native#16689 for more information. Closes #85 Reviewed By: mjesun Differential Revision: D6259177 Pulled By: rafeca fbshipit-source-id: 55987eb338b06938181c0da74d104d23eeb135b6
I believe the fix has landed in Metro Bundler with version 0.20.1. Can you try using it with https://yarnpkg.com/lang/en/docs/selective-version-resolutions/ system? Let me know if it fixes the problem and will release fixed 0.50 version right away. |
Can someone else affected please do this? I can test it tomorrow morning
CET earliest.
…On Tue, 7 Nov 2017 at 19:23, Mike Grabowski ***@***.***> wrote:
I believe the fix has landed in Metro Bundler with version 0.20.1. Can you
try using it with
https://yarnpkg.com/lang/en/docs/selective-version-resolutions/ system?
Let me know if it fixes the problem and will release fixed 0.50 version
right away.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16689 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAK22BM5WTM3DQCEKjdclfe3Q4qTlyJUks5s0KAtgaJpZM4QSowl>
.
|
Awesome that the issue is identified and fixed so quickly. I spent hours trying to troubleshoot this and it was driving me insane. 👍 |
Nevermind.... Spoke too soon, still getting:
@jamsch Were you able to fix this issue? |
@petejkim Unfortunately not. Even with adding the module resolution I'm having the same error as you are. |
The minified js bundle is working fine for me now. |
Seems to use the correct version of uglify-es
|
Can everyone who said the fix doesn't work make sure it's been applied
correctly? I have mixed feedback which is not helpful! So far we doing
great job.
I am going to be back to sleep now, but expect me to be online around 10
Central European Time.
…On Tue, 7 Nov 2017, 9:55 pm jamsch, ***@***.***> wrote:
Seems to use the correct version of uglify-es
├─┬ UNMET PEER DEPENDENCY ***@***.***
│ ├─┬ ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ ├── ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ ├── ***@***.***
│ │ ├── ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ ├── ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ ├── ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ ├── ***@***.***
│ │ ├── ***@***.***
│ │ ├── ***@***.*** deduped
│ │ ├── ***@***.***
│ │ └── ***@***.***
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#16689 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWcxsqNCjqCIm6QD2ADJnznzVi6xHveks5s0MPVgaJpZM4QSowl>
.
|
Yes those are applied correctly. (checked yarn.lock) It appears that the modules are not being loaded in correct order as well? (Polyfills for functions like setTimeout and requestAnimationFrame also appear to be missing when the app bundle is being loaded in release mode. try putting |
Confirmed fix in using resolving Metro Bundler with version 0.20.1 in |
I think there are multiple issues here. I did not have the |
@petejkim that is true in my case too. Haven't seen |
@petejkim It seems like the other issue that you are experiencing is facebook/metro#78 . This was fixed by 1a2a46a9fb3e3af2089c06ce7a25dbcd8737201b but we haven't released a major version of metro with that fix yet (I'm planning to release v0.21.0 tomorrow). @petejkim as a workaround, can you try to add a |
I confirm that with
Our app seems to be working fine but we are upgrading from RN 0.36 so we have a lot of QA to do. |
0.50.3 is on CI now and should be on `npm` soon.
…On Wed, 8 Nov 2017 at 10:47 Andreas Amsenius ***@***.***> wrote:
I confirm that with resolutions using metro bundler 0.20.1 in our project
solves:
- release bundling issue, which was the one initially reported
- release bundle crash (minification issue) which I reported above, #16689
(comment)
<#16689 (comment)>
Our app seems to be working fine but we are upgrading from RN 0.36 so we
have a lot of QA to do.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#16689 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWcxid-5Qo2AB6oMwclfmv6agLys98Aks5s0Xi4gaJpZM4QSowl>
.
|
You are a brave man. I confirm RN 0.50.3 fixed my issue, without need for bumping |
The issue with |
50.3 still crashes iOS apps that are in release mode. When can we expect a fix for this? @grabbou |
The fix has shipped. Can you check if the crash is related to this issue?
Is there any way for you to get the stack trace?
…On Thu, 9 Nov 2017 at 12:26 Alberto Blanco ***@***.***> wrote:
50.3 still crashes iOS apps that are in release mode. When can we expect a
fix for this? @grabbou <https://github.com/grabbou>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16689 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWcxnVONcu1y1ZZo8hNmjfoRX0uj5D9ks5s0uFvgaJpZM4QSowl>
.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
I get this error when I try to import a node module in react native (I know we cant import node modules in react-native, but there's a way doing it), I've raised an issue, please clarify philikon/ReactNativify#14 |
I'm on react-native 0.52.2 and facing this issue. The crash happens only in Android Release build. I suspect iOS Release build will have this issue too, but haven't tried to build an iOS release app yet.
|
react-native
|
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Steps to Reproduce
Just upgraded from 0.49.5 to 0.50.1 and tried to bundle. The breaking changes in the new release hadn't affected my app and shouldn't have affected the build process.
npm i react-native@0.50.1
react-native bundle --verbose --platform android --dev false --entry-file index.js --bundle-output output.bundle
Output:
On the other hand when I reinstalled react-native 0.49.5:
npm install react-native@0.49.5
react-native bundle --verbose --platform android --dev false --entry-file index.js --bundle-output output.bundle
Output:
What does work
Running react-native start (i.e. developer mode) works fine
Expected Behavior
The project should bundle correctly
Actual Behavior
The bundling fails with a stack overflow. There's no clear indication what is causing the behavior because there's no stack trace despite explicitly enabling verbose mode. I don't know whether stack traces of these errors are kept but it may be helpful in identifying the problem.
I upgraded Node (from v6 to v8) because I thought that may be causing it.
Installed packages
The text was updated successfully, but these errors were encountered: