You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
triggerUncaughtException with react-native 0.71.2 #116
I'm trying to utilize bundle visualizer with the latest react-native and I'm running into this output:
$ yarn run visualizer:release
$ yarn workspace @monorepo/main run react-native-bundle-visualizer --dev=false
$ /Users/fcalise/code/myproject/node_modules/.bin/react-native-bundle-visualizer --dev=false
Generating bundle...
Welcome to Metro v0.73.7
Fast - Scalable - Integrated
info Writing bundle output to:, /var/folders/pl/1r8l1pts2r3c2hbcpdbq4ppc0000gn/T/react-native-bundle-visualizer/monorepomain/ios.bundle
info Writing sourcemap output to:, /var/folders/pl/1r8l1pts2r3c2hbcpdbq4ppc0000gn/T/react-native-bundle-visualizer/monorepomain/ios.bundle.map
info Done writing sourcemap output
info Done writing bundle output
Bundle is 2.74 MB in size (unchanged since last run)
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
error Command failed with exit code 1.
Any suggestions or would you like any other information attached? Open to trying patches and other solutions
Thanks for the information. Could you please add your setup details for eg: react-native version and node version? Also if you could share package.json probably dependencies and dev deps only.
Here is a reproducible repo (with the dep list below). It also did this for me on version 0.71.2 of react-native. I tried both node version 16.14.2 and 18.11.0. I think for this react-native version they suggest 18 but either run the app in this case.
Hi @frankcalise, thanks for sharing this. I tried on react-native version 0.70.6 and below, it works fine. Seems there's something that's conflicting in later versions. I should see what's the cause of it.
@frankcalise I cloned your provided repro and ran yarn visualizer:release and I was able to repro it. However, when I ran yarn visualizer:dev, output was shown in the html report.
See the last one, which is successful output with dev bundle.
If visualising dev bundle helps unblocking you, please go with that. As I don't have any timeline to get this working for release bundle. I will try to prioritise this. 🤝
Cool, thanks for checking 😃 My wild guess is there's probably something changed in the internals of RN or any third party library. I will try to keep looking for the root cause of this meanwhile, to get this working on recent RN versions in release mode.
I tried to locate the source of issue in a couple of third party packages, including RN-CLI, React-Native and Metro. It turned out that recently metro has defaulted terser as their minifier. Previously, it was uglify which was playing nicely for our implemented solution to use source-map-explorer, which then uses source-map.
Now terser as a minifier for metro generates something which is probably unidentifiable for source-map. So for now, I have disabled --minify option that we can pass to RN-CLI for generating bundle and source map. With this, we can successfully visualise the source map on both dev and release. There's one downside to this approach and that's we will have artifacts generated without minification. But on a broader scale this shouldn't really matter.
For future, I will try to remove this more of a patch fix, and allow us using the minification. As I am not really much familiar with these minifier, transformers stuff, I can't promise a timeline for that, but I will try keep looking for ideas around it.
As of now, this fix/ patch should unblock us even on latest RN versions on both dev and release. Let me know, if this fix works for you. I will try to publish this fix soon. ✨
@hurali97 Thanks for your hard work! Yeah they both run now with that patch.
With regards to the minification, does skipping that impact the bundle size that is being reported now? Or is release mode still a true release bundle size?
Yes it impacts the bundle size to some extent as lines, spaces, function names, variable names etc won't be minified due to this. Other than this, release level optimisations must be applied on the bundle. So if you visualize bundle with dev true and later on with dev false, you should see a green line in terminal which would say: "bundle size decreased by __".
Activity
hurali97 commentedon Feb 11, 2023
Hi @frankcalise,
Thanks for the information. Could you please add your setup details for eg: react-native version and node version? Also if you could share package.json probably dependencies and dev deps only.
frankcalise commentedon Feb 11, 2023
hey @hurali97 sure thing!
Here is a reproducible repo (with the dep list below). It also did this for me on version
0.71.2ofreact-native. I tried both node version16.14.2and18.11.0. I think for this react-native version they suggest 18 but either run the app in this case.https://github.com/frankcalise/react-native-vanilla-reanimated
hurali97 commentedon Feb 11, 2023
Hi @frankcalise, thanks for sharing this. I tried on react-native version 0.70.6 and below, it works fine. Seems there's something that's conflicting in later versions. I should see what's the cause of it.
hurali97 commentedon Feb 11, 2023
UPDATE
@frankcalise I cloned your provided repro and ran
yarn visualizer:releaseand I was able to repro it. However, when I ranyarn visualizer:dev, output was shown in the html report.See the last one, which is successful output with dev bundle.
If visualising dev bundle helps unblocking you, please go with that. As I don't have any timeline to get this working for release bundle. I will try to prioritise this. 🤝
frankcalise commentedon Feb 11, 2023
Ok I will try dev again, but I thought I had the same issue. Maybe I'll try with clearing the cache first. Are there any temp files I should clear?
Thanks for looking into it!
hurali97 commentedon Feb 11, 2023
You can try running the visualiser command with
--reset-cacheflag.frankcalise commentedon Feb 11, 2023
@hurali97 visualizer:dev script ran on 0.71.1
And also was able to run
visualizer:releasewhen targeting 0.70.6 for ios/android platformshurali97 commentedon Feb 11, 2023
Cool, thanks for checking 😃 My wild guess is there's probably something changed in the internals of RN or any third party library. I will try to keep looking for the root cause of this meanwhile, to get this working on recent RN versions in release mode.
hurali97 commentedon Feb 12, 2023
Hi @frankcalise,
I pushed a fix on another branch, you can try it by running following command:
yarn add -D https://github.com/IjzerenHein/react-native-bundle-visualizer.git#fix-set-minify-to-falseI tried to locate the source of issue in a couple of third party packages, including RN-CLI, React-Native and Metro. It turned out that recently metro has defaulted
terseras their minifier. Previously, it wasuglifywhich was playing nicely for our implemented solution to usesource-map-explorer, which then usessource-map.Now
terseras aminifierfor metro generates something which is probably unidentifiable forsource-map. So for now, I have disabled--minifyoption that we can pass to RN-CLI for generating bundle and source map. With this, we can successfully visualise the source map on both dev and release. There's one downside to this approach and that's we will have artifacts generated without minification. But on a broader scale this shouldn't really matter.For future, I will try to remove this more of a patch fix, and allow us using the minification. As I am not really much familiar with these minifier, transformers stuff, I can't promise a timeline for that, but I will try keep looking for ideas around it.
As of now, this fix/ patch should unblock us even on latest RN versions on both dev and release. Let me know, if this fix works for you. I will try to publish this fix soon. ✨
frankcalise commentedon Feb 12, 2023
@hurali97 Thanks for your hard work! Yeah they both run now with that patch.
With regards to the minification, does skipping that impact the bundle size that is being reported now? Or is release mode still a true release bundle size?
hurali97 commentedon Feb 12, 2023
Hi @frankcalise,
Yes it impacts the bundle size to some extent as lines, spaces, function names, variable names etc won't be minified due to this. Other than this, release level optimisations must be applied on the bundle. So if you visualize bundle with dev true and later on with dev false, you should see a green line in terminal which would say: "bundle size decreased by __".