Skip to content

Commit 9ee875c

Browse files
committed
upgrade react, react-scripts and build overrides
1 parent e36105f commit 9ee875c

File tree

5 files changed

+35
-28
lines changed

5 files changed

+35
-28
lines changed

interface/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_ENDPOINT_ROOT=http://192.168.0.6/rest/
1+
REACT_APP_ENDPOINT_ROOT=http://192.168.0.26/rest/

interface/.env.production

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
REACT_APP_ENDPOINT_ROOT=/rest/
1+
REACT_APP_ENDPOINT_ROOT=/rest/
2+
GENERATE_SOURCEMAP=false

interface/config-overrides.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
const CompressionPlugin = require("compression-webpack-plugin");
21
const ManifestPlugin = require('webpack-manifest-plugin');
3-
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
4-
const ExtractTextPlugin = require('extract-text-webpack-plugin');
2+
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
3+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4+
const CompressionPlugin = require("compression-webpack-plugin");
55

66
const path = require('path');
77
const fs = require('fs');
88

99
module.exports = function override(config, env) {
1010
if (env === "production") {
1111
// rename the ouput file, we need it's path to be short, for SPIFFS
12-
config.output.filename = 'js/[name].[chunkhash:4].js';
13-
14-
// disable sourcemap for production build
15-
config.devtool = false;
12+
config.output.filename = 'js/[id].[chunkhash:4].js';
13+
config.output.chunkFilename = 'js/[id].[chunkhash:4].js';
1614

17-
// take out the manifest and service worker
15+
// take out the manifest and service worker plugins
1816
config.plugins = config.plugins.filter(plugin => !(plugin instanceof ManifestPlugin));
19-
config.plugins = config.plugins.filter(plugin => !(plugin instanceof SWPrecacheWebpackPlugin));
17+
config.plugins = config.plugins.filter(plugin => !(plugin instanceof WorkboxWebpackPlugin.GenerateSW));
2018

21-
const extractTextPlugin = config.plugins.find((plugin) => plugin instanceof ExtractTextPlugin);
22-
extractTextPlugin.filename = "css/[name].[contenthash:4].css";
19+
// shorten css filenames
20+
const miniCssExtractPlugin = config.plugins.find((plugin) => plugin instanceof MiniCssExtractPlugin);
21+
miniCssExtractPlugin.options.filename = "css/[id].[contenthash:4].css";
22+
miniCssExtractPlugin.options.chunkFilename = "css/[id].[contenthash:4].c.css";
2323

2424
// add compression plugin, compress javascript
2525
config.plugins.push(new CompressionPlugin({
26-
asset: "[path].gz[query]",
26+
filename: "[path].gz[query]",
2727
algorithm: "gzip",
2828
test: /\.(js)$/,
2929
deleteOriginalAssets: true

interface/package.json

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"dependencies": {
66
"@material-ui/core": "^3.9.3",
77
"@material-ui/icons": "^3.0.2",
8-
"compression-webpack-plugin": "^1.1.12",
9-
"moment": "^2.22.2",
10-
"prop-types": "^15.6.2",
11-
"react": "^16.5.1",
12-
"react-dom": "^16.5.1",
13-
"react-form-validator-core": "^0.3.0",
8+
"compression-webpack-plugin": "^2.0.0",
9+
"moment": "^2.24.0",
10+
"prop-types": "^15.7.2",
11+
"react": "^16.8.6",
12+
"react-dom": "^16.8.6",
13+
"react-form-validator-core": "^0.6.2",
1414
"react-jss": "^8.6.1",
15-
"react-material-ui-form-validator": "^2.0.1",
16-
"react-router": "^4.3.1",
17-
"react-router-dom": "^4.3.1",
18-
"react-scripts": "1.0.17"
15+
"react-material-ui-form-validator": "^2.0.7",
16+
"react-router": "^5.0.0",
17+
"react-router-dom": "^5.0.0",
18+
"react-scripts": "2.1.8"
1919
},
2020
"scripts": {
2121
"start": "react-app-rewired start",
@@ -24,6 +24,12 @@
2424
"eject": "react-scripts eject"
2525
},
2626
"devDependencies": {
27-
"react-app-rewired": "^1.6.2"
28-
}
27+
"react-app-rewired": "^2.1.1"
28+
},
29+
"browserslist": [
30+
">0.2%",
31+
"not dead",
32+
"not ie <= 11",
33+
"not op_mini all"
34+
]
2935
}

interface/src/forms/WiFiSettingsForm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ class WiFiSettingsForm extends React.Component {
7979
}
8080

8181
render() {
82-
const { classes, formRef, wifiSettingsFetched, wifiSettings, errorMessage, selectedNetwork, handleValueChange, handleCheckboxChange, onSubmit, onReset } = this.props;
82+
const { classes, wifiSettingsFetched, wifiSettings, errorMessage, selectedNetwork, handleValueChange, handleCheckboxChange, onSubmit, onReset } = this.props;
8383
return (
84-
<div ref={formRef}>
84+
<div>
8585
{
8686
!wifiSettingsFetched ?
8787

0 commit comments

Comments
 (0)