IjzerenHein / react-native-bundle-visualizer

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

fix: set minify to false #117

Closed hurali97 closed 1 year ago

hurali97 commented 1 year ago

Description

Fixes #116

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.

Test Plan

Ran yarn test and output is all green. 🟢 Also tested on latest RN version(0.71) and expo SDK(47).