react-native-bundle-visualizer icon indicating copy to clipboard operation
react-native-bundle-visualizer copied to clipboard

Accept metro bundler config as an argument.

Open Sakethtadimeti opened this issue 11 months ago • 1 comments

Proposed change:

Accept a --config argument & pass it on to react native bundle command.

Example usage - react-native-bundle-visualizer --platform android --config metro+esbuild.config.js

Why is this needed: It'll be easier to view bundle sizes when testing out different configurations of metro config.

Ex:: Bundling with es-build /without es-build.

Sakethtadimeti avatar Mar 09 '24 10:03 Sakethtadimeti

@IjzerenHein Please let me if this makes sense. I'll be happy to send a PR in.

For more context - Esbuild (with tree shaking support) for metro bundler is out in beta. https://www.npmjs.com/package/@rnx-kit/metro-serializer-esbuild. There is a known limitation that it only works correctly with production builds & hence needs us to maintain 2 versions of metro config.

While trying to visualize the difference in bundle sizes with & without es-build transformations, we realized doesn't accept a config arg currently.

https://github.com/IjzerenHein/react-native-bundle-visualizer/blob/main/src/react-native-bundle-visualizer.js#L86-#L100

Sakethtadimeti avatar Mar 09 '24 10:03 Sakethtadimeti