webpack.prod.config

/**
 * Created by wensonsmith on 2017/12/5.
 */
const webpack = require('webpack')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const merge = require('webpack-merge')
const webpackBaseConfig = require('./webpack.base.config.js')
const CleanWebpackPlugin = require('clean-webpack-plugin')

module.exports = merge(webpackBaseConfig, {
    devtool: false,

    output: {
        path: path.join(__dirname, '../../../web/js/pages/tuition'),
        filename: '[name].[hash].js',
        chunkFilename: '[name].[hash].chunk.js',
        publicPath: '/js/pages/tuition/'
    },
    plugins: [
        new ExtractTextPlugin({
            filename: '[name].[hash].css',
            allChunks: true
        }),

        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: '"production"'
            }
        }),

        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false,
                drop_console: false,
            },
            sourceMap: false
        }),

        new CleanWebpackPlugin(['web/js/pages/tuition/*'], {
            root: path.join(__dirname, '../../../'),
            verbose: true
        }),


    ]
})