Change minifierConfig for minify/uglify

found a way to replace minify configs:

Add in app.json

"packagerOpts": {
  "config": "metro.config.js"
},

create metro.config.js in root project directory:

module.exports = {
     transformer: {
      minifierConfig: {
        keep_classnames: true, // FIX typeorm
        keep_fnames: true, // FIX typeorm
        mangle: {
          // toplevel: false,
          keep_classnames: true, // FIX typeorm
          keep_fnames: true, // FIX typeorm
        },
        output: {
          ascii_only: true,
          quote_style: 3,
          wrap_iife: true,
        },
        sourceMap: {
          includeSources: false,
        },
        toplevel: false,
        compress: {
          // reduce_funcs inlines single-use functions, which cause perf regressions.
          reduce_funcs: false,
        },
      },
    },
};

i still need to check if theres a way to change this config only for the typeorm package

4 Likes