Skip to content

Commit 5247a7f

Browse files
committed
bug fix
1 parent 2ff3cd4 commit 5247a7f

File tree

3 files changed

+55
-123
lines changed

3 files changed

+55
-123
lines changed

package-lock.json

Lines changed: 35 additions & 107 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chrome-extension-boilerplate-react",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "A chrome extension boilerplate built with React 17 and Webpack 4",
55
"license": "MIT",
66
"repository": {
@@ -41,14 +41,14 @@
4141
"file-loader": "^6.1.1",
4242
"fs-extra": "^9.0.1",
4343
"html-loader": "^1.3.2",
44-
"html-webpack-plugin": "^4.5.0",
44+
"html-webpack-plugin": "^5.0.0-alpha.7",
4545
"node-sass": "^4.14.1",
4646
"prettier": "^2.1.2",
4747
"sass-loader": "^10.0.4",
4848
"style-loader": "^2.0.0",
49+
"terser-webpack-plugin": "^5.0.2",
4950
"webpack": "^5.2.0",
5051
"webpack-cli": "^4.1.0",
51-
"webpack-dev-server": "^3.11.0",
52-
"write-file-webpack-plugin": "^4.5.1"
52+
"webpack-dev-server": "^3.11.0"
5353
}
5454
}

webpack.config.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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
1010
var alias = {
1111
'react-dom': '@hot-loader/react-dom',
1212
};
1313

14+
// load the secrets
1415
var secretsPath = path.join(__dirname, 'secrets.' + env.NODE_ENV + '.js');
1516

1617
var 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: /\.(css|scss)$/,
@@ -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

175170
if (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

179183
module.exports = options;

0 commit comments

Comments
 (0)