@@ -4,13 +4,14 @@ var webpack = require('webpack'),
4
4
env = require ( './utils/env' ) ,
5
5
{ CleanWebpackPlugin } = require ( 'clean-webpack-plugin' ) ,
6
6
CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ,
7
- HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
7
+ HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ,
8
+ TerserPlugin = require ( 'terser-webpack-plugin' ) ;
8
9
9
- // load the secrets
10
10
var alias = {
11
11
'react-dom' : '@hot-loader/react-dom' ,
12
12
} ;
13
13
14
+ // load the secrets
14
15
var secretsPath = path . join ( __dirname , 'secrets.' + env . NODE_ENV + '.js' ) ;
15
16
16
17
var fileExtensions = [
@@ -48,16 +49,6 @@ var options = {
48
49
} ,
49
50
module : {
50
51
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
- // },
61
52
{
62
53
// look for .css or .scss files
63
54
test : / \. ( c s s | s c s s ) $ / ,
@@ -144,16 +135,19 @@ var options = {
144
135
template : path . join ( __dirname , 'src' , 'pages' , 'Newtab' , 'index.html' ) ,
145
136
filename : 'newtab.html' ,
146
137
chunks : [ 'newtab' ] ,
138
+ cache : false ,
147
139
} ) ,
148
140
new HtmlWebpackPlugin ( {
149
141
template : path . join ( __dirname , 'src' , 'pages' , 'Options' , 'index.html' ) ,
150
142
filename : 'options.html' ,
151
143
chunks : [ 'options' ] ,
144
+ cache : false ,
152
145
} ) ,
153
146
new HtmlWebpackPlugin ( {
154
147
template : path . join ( __dirname , 'src' , 'pages' , 'Popup' , 'index.html' ) ,
155
148
filename : 'popup.html' ,
156
149
chunks : [ 'popup' ] ,
150
+ cache : false ,
157
151
} ) ,
158
152
new HtmlWebpackPlugin ( {
159
153
template : path . join (
@@ -165,6 +159,7 @@ var options = {
165
159
) ,
166
160
filename : 'background.html' ,
167
161
chunks : [ 'background' ] ,
162
+ cache : false ,
168
163
} ) ,
169
164
] ,
170
165
infrastructureLogging : {
@@ -174,6 +169,15 @@ var options = {
174
169
175
170
if ( env . NODE_ENV === 'development' ) {
176
171
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
+ } ;
177
181
}
178
182
179
183
module . exports = options ;
0 commit comments