@@ -4,13 +4,14 @@ var webpack = require('webpack'),
44 env = require ( './utils/env' ) ,
55 { CleanWebpackPlugin } = require ( 'clean-webpack-plugin' ) ,
66 CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ,
7- HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
7+ HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ,
8+ TerserPlugin = require ( 'terser-webpack-plugin' ) ;
89
9- // load the secrets
1010var alias = {
1111 'react-dom' : '@hot-loader/react-dom' ,
1212} ;
1313
14+ // load the secrets
1415var secretsPath = path . join ( __dirname , 'secrets.' + env . NODE_ENV + '.js' ) ;
1516
1617var fileExtensions = [
@@ -48,16 +49,6 @@ var options = {
4849 } ,
4950 module : {
5051 rules : [
51- // {
52- // test: /\.css$/,
53- // loader: 'style-loader!css-loader',
54- // exclude: /node_modules/,
55- // },
56- // {
57- // test: /\.scss$/,
58- // loader: 'sass-loader',
59- // exclude: /node_modules/,
60- // },
6152 {
6253 // look for .css or .scss files
6354 test : / \. ( c s s | s c s s ) $ / ,
@@ -144,16 +135,19 @@ var options = {
144135 template : path . join ( __dirname , 'src' , 'pages' , 'Newtab' , 'index.html' ) ,
145136 filename : 'newtab.html' ,
146137 chunks : [ 'newtab' ] ,
138+ cache : false ,
147139 } ) ,
148140 new HtmlWebpackPlugin ( {
149141 template : path . join ( __dirname , 'src' , 'pages' , 'Options' , 'index.html' ) ,
150142 filename : 'options.html' ,
151143 chunks : [ 'options' ] ,
144+ cache : false ,
152145 } ) ,
153146 new HtmlWebpackPlugin ( {
154147 template : path . join ( __dirname , 'src' , 'pages' , 'Popup' , 'index.html' ) ,
155148 filename : 'popup.html' ,
156149 chunks : [ 'popup' ] ,
150+ cache : false ,
157151 } ) ,
158152 new HtmlWebpackPlugin ( {
159153 template : path . join (
@@ -165,6 +159,7 @@ var options = {
165159 ) ,
166160 filename : 'background.html' ,
167161 chunks : [ 'background' ] ,
162+ cache : false ,
168163 } ) ,
169164 ] ,
170165 infrastructureLogging : {
@@ -174,6 +169,15 @@ var options = {
174169
175170if ( env . NODE_ENV === 'development' ) {
176171 options . devtool = 'eval-cheap-module-source-map' ;
172+ } else {
173+ options . optimization = {
174+ minimize : true ,
175+ minimizer : [
176+ new TerserPlugin ( {
177+ extractComments : false ,
178+ } ) ,
179+ ] ,
180+ } ;
177181}
178182
179183module . exports = options ;
0 commit comments