text: const path = require('path')
  const utils = require('./utils/utils')
  const webpack = require('webpack')
  const config = require('./config')
  const merge = require('webpack-merge')
  const baseWebpackConfig = require('./webpack.base.conf')
  const CopyWebpackPlugin = require('copy-webpack-plugin')
  const HtmlWebpackPlugin = require('html-webpack-plugin')
  const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
  const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin')
  const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
  const CleanWebpackPlugin = require('clean-webpack-plugin')
  
  const env = config.build.env
  
  const babel = require('babel-core')
  const uglify = require('uglify-js')
  
  const webpackConfig = merge(baseWebpackConfig, {
    mode: 'production',
    module: {
      rules: utils.styleLoaders({
        sourceMap: config.build.productionSourceMap,
        extract: false
      })
    },
    devtool: config.build.productionSourceMap ? '#source-map' : false,
    output: {
      path: config.build.assetsRoot,
      filename: utils.assetsPath('js/[name].[chunkhash].js'),
      chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
    },
    plugins: [
      new CleanWebpackPlugin(),
      // http://vuejs.github.io/vue-loader/en/workflow/production.html
      new webpack.DefinePlugin({
        'process.env': env
      }),
  
      new UglifyJsPlugin({
        uglifyOptions: {
          ecma: 5,
          compress: true,
          mangle: true
        },
        extractComments: true,
        sourceMap: false,
        cache: true,
        parallel: false
      }),
  
      // Compress extracted CSS. We are using this plugin so that possible
      // duplicated CSS from different components can be deduped.
      new OptimizeCSSPlugin({
        cssProcessorOptions: {
          safe: true
        }
      }),
      new HtmlWebpackPlugin({
        filename: config.build.index,
        template: 'index.html',
        inject: true,
        minify: {
          removeComments: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true
          // more options:
          // https://github.com/kangax/html-minifier#options-quick-reference
        },
        // necessary to consistently work with multiple chunks via CommonsChunkPlugin
        chunksSortMode: 'dependency',
      }),
  
      new CopyWebpackPlugin([
        {
          from: path.resolve(__dirname, '../static'),
          to: config.build.assetsSubDirectory,
          ignore: ['.*']
        }
      ]),
    ]
  })
  
  module.exports = webpackConfig
  