@@ -9,7 +9,7 @@ let isProduction = process.env.NODE_ENV === 'production';
99const getLogger = require ( 'webpack-log' ) ;
1010const log = getLogger ( { name : 'webpack-batman' } ) ;
1111const MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' ) ;
12-
12+ const CssMinimizerPlugin = require ( 'css-minimizer-webpack-plugin' ) ;
1313log . info ( __filename ) ;
1414
1515// This is main configuration object.
@@ -40,7 +40,7 @@ module.exports = {
4040 // else
4141 // return isProduction ? '[name].min.js' : '[name].js';
4242 // },
43-
43+ chunkFilename : isProduction ? '[name].min.js' : '[name].js' ,
4444 libraryTarget : 'umd' ,
4545 libraryExport : 'default' ,
4646 library : 'CoCreate' ,
@@ -54,8 +54,8 @@ module.exports = {
5454 new MiniCssExtractPlugin ( {
5555 // Options similar to the same options in webpackOptions.output
5656 // both options are optional
57- filename : '[name].css' ,
58- chunkFilename : '[id] .css' ,
57+ filename : isProduction ? '[name].min.css' : '[name].css' ,
58+ chunkFilename : '[name].min .css' ,
5959 } ) ,
6060 ] ,
6161
@@ -98,21 +98,22 @@ module.exports = {
9898
9999 optimization : {
100100 minimize : true ,
101- // minimizer: [
102- // new TerserPlugin({
103- // extractComments: true,
104- // // cache: true,
105- // parallel: true,
106- // // sourceMap: true, // Must be set to true if using source-maps in production
107- // terserOptions: {
108- // // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
109- // // extractComments: 'all',
110- // compress: {
111- // drop_console: true,
112- // },
113- // },
114- // }),
115- // ],
101+ minimizer : [
102+ new CssMinimizerPlugin ( ) ,
103+ new TerserPlugin ( {
104+ extractComments : true ,
105+ // cache: true,
106+ parallel : true ,
107+ // sourceMap: true, // Must be set to true if using source-maps in production
108+ terserOptions : {
109+ // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
110+ // extractComments: 'all',
111+ compress : {
112+ drop_console : true ,
113+ } ,
114+ } ,
115+ } ) ,
116+ ] ,
116117 splitChunks : {
117118 chunks : 'all' ,
118119 minSize : 1 ,
0 commit comments