IjzerenHein / react-native-bundle-visualizer

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

Verbose gives size [object Object] #73

Closed aakashchoubey closed 1 year ago

aakashchoubey commented 2 years ago

Steps to repro

I am running this line. I tried --verbose option for more visibility on numbers in cli.

react-native-bundle-visualizer --entry-file index.js --dev false --platform ios --bundle-output build/ios/main.jsbundle --verbose

With this, I was getting size field like this

---/node_modules/metro-config/node_modules/metro/src/lib/polyfills/require.js, size: [object Object] bytes
---/node_modules/react-native/Libraries/polyfills/console.js, size: [object Object] bytes
---/node_modules/react-native/Libraries/polyfills/error-guard.js, size: [object Object] bytes
---/node_modules/react-native/Libraries/polyfills/Object.es7.js, size: [object Object] bytes

Configuration

Package Version = react-native-bundle-visualizer@3.1.1 
Node Version = 14.18.0
Npm Version = 6.14.15

Fix

I tried updating this line to console bundle.files[file].size instead and the output was presented correctly as expected.

I did not dive into why this happens or if I am able to get the same on a different node version. But just found something and thought I should let people know here. I'll update here once I have some time to check on different node versions.

IjzerenHein commented 2 years ago

Thanks for reporting that here @choubeyaakash77 . It might be an issue with the verbose option indeed. Yeah if you could check other node versions, that would be great!