const WebpackObfuscator = require("webpack-obfuscator");
//const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
//  .BundleAnalyzerPlugin;

let plugins = [
  //new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  //new BundleAnalyzerPlugin(),
];
if (process.env.NODE_ENV === "production") {
  plugins.push(
    new WebpackObfuscator(
      {
        rotateStringArray: true,
      },
      ["**/chunk-vendors.*.js"]
    )
  );
}

module.exports = {
  configureWebpack: {
    devtool: process.env.NODE_ENV === "production" ? "none" : "eval-source-map",
    plugins: plugins,
  },
  runtimeCompiler: false,
  lintOnSave: true,
  publicPath: "",
};
