Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lxieyang committed Oct 27, 2020
1 parent 2ff3cd4 commit 5247a7f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 123 deletions.
142 changes: 35 additions & 107 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chrome-extension-boilerplate-react",
"version": "3.0.0",
"version": "3.0.1",
"description": "A chrome extension boilerplate built with React 17 and Webpack 4",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -41,14 +41,14 @@
"file-loader": "^6.1.1",
"fs-extra": "^9.0.1",
"html-loader": "^1.3.2",
"html-webpack-plugin": "^4.5.0",
"html-webpack-plugin": "^5.0.0-alpha.7",
"node-sass": "^4.14.1",
"prettier": "^2.1.2",
"sass-loader": "^10.0.4",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.0.2",
"webpack": "^5.2.0",
"webpack-cli": "^4.1.0",
"webpack-dev-server": "^3.11.0",
"write-file-webpack-plugin": "^4.5.1"
"webpack-dev-server": "^3.11.0"
}
}
28 changes: 16 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ var webpack = require('webpack'),
env = require('./utils/env'),
{ CleanWebpackPlugin } = require('clean-webpack-plugin'),
CopyWebpackPlugin = require('copy-webpack-plugin'),
HtmlWebpackPlugin = require('html-webpack-plugin');
HtmlWebpackPlugin = require('html-webpack-plugin'),
TerserPlugin = require('terser-webpack-plugin');

// load the secrets
var alias = {
'react-dom': '@hot-loader/react-dom',
};

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

var fileExtensions = [
Expand Down Expand Up @@ -48,16 +49,6 @@ var options = {
},
module: {
rules: [
// {
// test: /\.css$/,
// loader: 'style-loader!css-loader',
// exclude: /node_modules/,
// },
// {
// test: /\.scss$/,
// loader: 'sass-loader',
// exclude: /node_modules/,
// },
{
// look for .css or .scss files
test: /\.(css|scss)$/,
Expand Down Expand Up @@ -144,16 +135,19 @@ var options = {
template: path.join(__dirname, 'src', 'pages', 'Newtab', 'index.html'),
filename: 'newtab.html',
chunks: ['newtab'],
cache: false,
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src', 'pages', 'Options', 'index.html'),
filename: 'options.html',
chunks: ['options'],
cache: false,
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src', 'pages', 'Popup', 'index.html'),
filename: 'popup.html',
chunks: ['popup'],
cache: false,
}),
new HtmlWebpackPlugin({
template: path.join(
Expand All @@ -165,6 +159,7 @@ var options = {
),
filename: 'background.html',
chunks: ['background'],
cache: false,
}),
],
infrastructureLogging: {
Expand All @@ -174,6 +169,15 @@ var options = {

if (env.NODE_ENV === 'development') {
options.devtool = 'eval-cheap-module-source-map';
} else {
options.optimization = {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false,
}),
],
};
}

module.exports = options;

0 comments on commit 5247a7f

Please sign in to comment.