'use strict'
// 一键装载js打包
const baseWebpackConfig = require('./webpack.base.conf')
const path = require('path')
const merge = require('webpack-merge')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

const output = process.env.OUTPUT || resolve('static')

function resolve (dir) {
  return path.join(__dirname, '..', dir)
}

delete baseWebpackConfig.entry
delete baseWebpackConfig.optimization.splitChunks
const webpackConfig = merge(baseWebpackConfig, {
  mode: 'production',
  devtool: false,
  entry: './src/oneKeyReprint.js',
  output: {
    path: output,
    filename: 'oneKeyReprint.js'
  },
  optimization: {
  }
})
webpackConfig.optimization.minimizer = [
  new UglifyJsPlugin({
    uglifyOptions: {
      compress: {
        warnings: false
      }
    },
    sourceMap: true,
    parallel: true
  })
]

module.exports = webpackConfig
