IjzerenHein / react-native-bundle-visualizer

See what packages are increasing your react-native bundle size 📦
MIT License
1.43k stars 42 forks source link

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(). #111

Closed LinFeiLong closed 1 year ago

LinFeiLong commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-bundle-visualizer@3.1.1 for the project I'm working on.

This is a fix proposal to this issue https://github.com/IjzerenHein/react-native-bundle-visualizer/issues/38

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-bundle-visualizer/src/react-native-bundle-visualizer.js b/node_modules/react-native-bundle-visualizer/src/react-native-bundle-visualizer.js
index 6487b5c..cf608f2 100755
--- a/node_modules/react-native-bundle-visualizer/src/react-native-bundle-visualizer.js
+++ b/node_modules/react-native-bundle-visualizer/src/react-native-bundle-visualizer.js
@@ -140,8 +140,8 @@ bundlePromise
       console.log(
         chalk.green.bold(
           'Bundle is ' +
-            Math.round((stats.size / (1024 * 1024)) * 100) / 100 +
-            ' MB in size'
+          Math.round((stats.size / (1024 * 1024)) * 100) / 100 +
+          ' MB in size'
         ) + deltaSuffix
       );

@@ -188,4 +188,5 @@ bundlePromise

     // Open output file
     return open(bundleOutputExplorerFile);
-  });
+  })
+  .catch((error) => { });

This issue body was partially generated by patch-package.