const rewire = require('rewire');
const defaults = rewire('react-scripts/scripts/build.js');
const config = defaults.__get__('config');


//config.optimization.minimize = false;
// Consolidate chunk files instead
config.optimization.splitChunks = {
  cacheGroups: {
    default: false,
  },
};
// Move runtime into bundle instead of separate file
config.optimization.runtimeChunk = false;

// JS
config.output.filename = '[name].js';
// config.optimization.minimizer[0].options.terserOptions = {
//   ecma: undefined,
//   warnings: false,
//   parse: {},
//   compress: {},
//   mangle: true, // Note `mangle.properties` is `false` by default.
//   module: false,
//   output: null,
//   toplevel: false,
//   nameCache: null,
//   ie8: false,
//   keep_classnames: undefined,
//   keep_fnames: false,
//   safari10: false,
//};
config.optimization.minimizer[0].options.terserOptions.keep_classnames = true;
config.optimization.minimizer[0].options.terserOptions.keep_fnames = true;
console.log(config.optimization.minimizer[0]);
// CSS. "5" is MiniCssPlugin
config.plugins[5].options.filename = '[name].css';
config.plugins[5].options.publicPath = '../';