Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
skb1129 committed Jan 11, 2021
1 parent 4446f13 commit 3760a51
Show file tree
Hide file tree
Showing 5 changed files with 1,481 additions and 2,284 deletions.
59 changes: 30 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-react-boilerplate",
"version": "2.0.0",
"version": "2.1.0",
"description": "Cross platform desktop app built using Electron and React.",
"main": "build/main.js",
"repository": "https://github.com/skb1129/electron-react-app",
Expand All @@ -10,7 +10,7 @@
"scripts": {
"build": "webpack",
"compile": "tsc --project tsconfig.build.json",
"start:renderer": "webpack-dev-server --env.development",
"start:renderer": "webpack serve --env development",
"start:main": "yarn compile && NODE_ENV=development electron .",
"prestart": "yarn build && yarn compile",
"start": "NODE_ENV=production electron .",
Expand All @@ -21,39 +21,40 @@
},
"dependencies": {
"dotenv": "^8.2.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"@babel/preset-typescript": "^7.12.1",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.12.10",
"@babel/preset-typescript": "^7.12.7",
"@hot-loader/react-dom": "^17.0.1",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-hot-loader": "^4.1.1",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"babel-loader": "^8.1.0",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"babel-loader": "^8.2.2",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.2.1",
"css-loader": "^5.0.0",
"electron": "^10.1.4",
"copy-webpack-plugin": "^7.0.0",
"css-loader": "^5.0.1",
"electron": "^11.1.1",
"electron-builder": "^22.9.1",
"eslint": "^7.11.0",
"eslint-plugin-react": "^7.21.5",
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^1.1.1",
"node-sass": "^4.14.1",
"prettier": "^2.1.2",
"eslint": "^7.17.0",
"eslint-plugin-react": "^7.22.0",
"html-webpack-plugin": "^5.0.0-beta.4",
"mini-css-extract-plugin": "^1.3.3",
"node-sass": "^5.0.0",
"prettier": "^2.2.1",
"react-hot-loader": "^4.13.0",
"sass-loader": "^10.0.3",
"sass-loader": "^10.1.1",
"style-loader": "^2.0.0",
"typescript": "^4.0.3",
"typescript-plugin-css-modules": "^2.7.0",
"webpack": "^4.44.2",
"webpack-bundle-analyzer": "^3.9.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
"typescript": "^4.1.3",
"typescript-plugin-css-modules": "^3.0.1",
"webpack": "^5.12.3",
"webpack-bundle-analyzer": "^4.3.0",
"webpack-cli": "^4.3.1",
"webpack-dev-server": "^3.11.1"
}
}
3 changes: 0 additions & 3 deletions public/index.html → public/development.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<%= htmlWebpackPlugin.tags.headTags %>
<!--TODO: Use html-webpack-exclude-assets-plugin-->
<link href="renderer.css" rel="stylesheet" />
<title><%= htmlWebpackPlugin.options.title %></title>
</head>

<body>
<div id="root"></div>
<%= htmlWebpackPlugin.tags.bodyTags %>
</body>
</html>
16 changes: 16 additions & 0 deletions public/production.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src https://*; child-src 'none';" />
<link href="styles.css" rel="stylesheet" />
<title><%= htmlWebpackPlugin.options.title %></title>
</head>

<body>
<div id="root"></div>
</body>
</html>
139 changes: 67 additions & 72 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,82 +5,77 @@ const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = ({ development } = { development: false }) => ({
mode: development ? "development" : "production",
devServer: {
host: "0.0.0.0",
port: "3000",
proxy: {
"**": {
bypass(req) {
if (req.headers.accept.includes("html")) {
return "/index.html";
}
module.exports = (env) => {
const { development = false } = env;
return {
mode: development ? "development" : "production",
devServer: {
host: "0.0.0.0",
port: "3000",
proxy: {
"**": {
bypass(req) {
if (req.headers.accept.includes("html")) {
return "/index.html";
}
},
},
},
headers: {
"Access-Control-Allow-Origin": "*",
},
hot: true,
overlay: true,
historyApiFallback: true,
},
headers: {
"Access-Control-Allow-Origin": "*",
resolve: { extensions: [".js", ".jsx", ".ts", ".tsx", ".css", ".scss"] },
entry: {
renderer: "./index.tsx",
},
hot: true,
overlay: true,
historyApiFallback: true,
},
resolve: { extensions: [".js", ".jsx", ".ts", ".tsx", ".css", ".scss"] },
entry: {
renderer: "./index.tsx",
},
target: development ? "electron-renderer" : "electron-preload",
module: {
rules: [
{
loader: "babel-loader",
exclude: /node_modules/,
test: /\.(tsx|ts|jsx|js)?$/,
},
{
test: /\.(scss|css)?$/,
use: [
development ? "style-loader" : MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
importLoaders: 1,
modules: {
localIdentName: "[name]__[local]__[contenthash:base64:5]",
exportLocalsConvention: "camelCaseOnly",
target: development ? "electron-renderer" : "electron-preload",
module: {
rules: [
{
loader: "babel-loader",
exclude: /node_modules/,
test: /\.(tsx|ts|jsx|js)?$/,
},
{
test: /\.(scss|css)?$/,
use: [
development ? "style-loader" : MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
importLoaders: 1,
modules: {
localIdentName: "[name]__[local]__[contenthash:base64:5]",
exportLocalsConvention: "camelCaseOnly",
},
},
},
},
"sass-loader",
],
},
],
},
output: {
path: path.join(__dirname, "./build/"),
filename: "[name].js",
},
plugins: [
new CleanWebpackPlugin(),
new HTMLWebpackPlugin({
title: "ElectronReact",
filename: "index.html",
template: "public/index.html",
chunks: development ? ["renderer"] : [],
meta: {
"Content-Security-Policy": {
"http-equiv": "Content-Security-Policy",
content: `default-src ${
development ? "'self' 'unsafe-eval' 'unsafe-inline'" : "'self'"
}; img-src https://*; child-src 'none';`,
"sass-loader",
],
},
},
xhtml: true,
inject: false,
}),
new MiniCssExtractPlugin({ filename: "[name].css" }),
new CopyPlugin({ patterns: [{ from: "*.png", context: "public" }] }),
new EnvironmentPlugin({ HMR: development }),
],
});
],
},
output: {
path: path.join(__dirname, "./build/"),
filename: "[name].js",
},
plugins: [
new CleanWebpackPlugin(),
new HTMLWebpackPlugin({
title: "ElectronReact",
filename: "index.html",
template: development ? "public/development.html" : "public/production.html",
chunks: development ? ["renderer"] : [],
xhtml: true,
inject: false,
}),
new MiniCssExtractPlugin({ filename: "styles.css" }),
new CopyPlugin({ patterns: [{ from: "*.png", context: "public" }] }),
new EnvironmentPlugin({ HMR: development }),
],
};
};
Loading

0 comments on commit 3760a51

Please sign in to comment.