const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = merge(common, {
    entry: {
        'nonstop.min': './src/nonstop.ts',
    },
    output: {
        chunkFilename: '[name].min.js',
    },
    plugins: [
        new MiniCssExtractPlugin({
            chunkFilename: '[name].min.css'
        }),
    ],
    mode: 'production',
    optimization: {
        minimize: true,
        minimizer: [
            new UglifyJsPlugin(),
            new OptimizeCSSAssetsPlugin()
        ],
        splitChunks: {
            cacheGroups: {
                vendors: false,
            }
        }
    },
});