IjzerenHein / react-native-bundle-visualizer

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

Pass existing bundle as argument #36

Closed punksta closed 3 years ago

punksta commented 3 years ago

I would like to pass existing bundle and sourcemap as arguments, so I don't build JS bundle twice on CI.

npx react-native-bundle-visualizer --bundle-path index.android.bundle --source-maps index.android.bundle.map

IjzerenHein commented 3 years ago

To understand your request better, I'd like to understand how you use this on CI. What output format are you targeting and how do you use the output on CI?

punksta commented 3 years ago

Currently I am targeting html format and just adding it into GA artifacts. If bundle size increased at a threshold devs can download artifacts and investigate it.

punksta commented 3 years ago

I am using release bundle from android/app/build/generated/ so I don't need to build JS again.

IjzerenHein commented 3 years ago

Currently I am targeting html format and just adding it into GA artifacts. If bundle size increased at a threshold devs can download artifacts and investigate it.

Ah I see, yeah seems like a good use-case

IjzerenHein commented 3 years ago

So, I don't have any plans on implementing this myself, but if you would like to provide a PR, I'll consider it.

The bulk of what rnbv does is to bundle and then it runs it through the source-map-explorer. You could probably also write a simple script that calls the source-map-explorer with the bundle and map-file. https://github.com/IjzerenHein/react-native-bundle-visualizer/blob/master/src/react-native-bundle-visualizer.js#L126-L138

punksta commented 3 years ago

Looks like I can just do npx source-map-explorer index.android.bundle index.android.bundle.map :)

Thank you!

IjzerenHein commented 3 years ago

Even better :) 👍