"use strict";

var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");

var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");

var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");

_Object$defineProperty(exports, "__esModule", {
  value: true
});

exports.default = void 0;

var _path = require("path");

var _webpack = _interopRequireDefault(require("webpack"));

var _webpackMerge = _interopRequireDefault(require("webpack-merge"));

var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));

var _yargs = require("yargs");

var _extendWebpackConfig = _interopRequireDefault(require("../../utils/extendWebpackConfig"));

var _babelDefine = _interopRequireDefault(require("../../babel-define"));

var plugins = _interopRequireWildcard(require("./webpack.plugins"));

var _webpack3 = _interopRequireWildcard(require("./webpack.config"));

function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// import OptimizeCssAssetsPlugin from 'optimize-css-assets-webpack-plugin'
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
const configPlugins = [new _webpack.default.DefinePlugin((0, _babelDefine.default)('production')), // new webpack.optimize.AggressiveMergingPlugin({ minSizeReduce: 1.0 }),
new _copyWebpackPlugin.default([{
  from: (0, _path.resolve)(_webpack3.CWD, 'web.config'),
  to: (0, _path.resolve)(_webpack3.CWD, '_dist')
}]) // new webpack.optimize.CommonsChunkPlugin({
// 	name: 'Vendor',
// 	minChunks: module => /node_modules/.test(module.context)
// }),
//new BundleAnalyzerPlugin() // This can be used to visually get package sizes
];
const config = (0, _webpackMerge.default)(_webpack3.default, {
  //devtool: 'source-map',
  plugins: configPlugins,
  mode: 'production'
});

var _default = (0, _extendWebpackConfig.default)(config, _webpack3.ROOT_PATH, plugins);

exports.default = _default;
module.exports = exports.default;