Skip to content

Commit d54476a

Browse files
Merge pull request #167 from wednesday-solutions/feat/upgrade-webpack
Feat/upgrade webpack
2 parents 73cf428 + bf05332 commit d54476a

File tree

11 files changed

+633
-511
lines changed

11 files changed

+633
-511
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
node-version: [12.x]
11+
node-version: [16.14.x]
1212

1313
steps:
1414
- uses: actions/checkout@v2

app/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import history from 'utils/history';
1616
import 'sanitize.css/sanitize.css';
1717

1818
// Import root app
19-
import App from 'containers/App';
19+
import App from 'containers/App/Loadable';
2020

2121
// Import Language Provider
2222
import LanguageProvider from 'containers/LanguageProvider';

app/containers/App/Loadable.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
*
3+
* Asynchronously loads the component for App
4+
*
5+
*/
6+
7+
import loadable from 'utils/loadable';
8+
9+
export default loadable(() => import('./index'));

app/i18n.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* You CANNOT use import/export in this file.
99
*/
1010
//eslint-disable-line
11-
import '@formatjs/intl-relativetimeformat/polyfill';
12-
import '@formatjs/intl-relativetimeformat/locale-data/en';
1311

1412
const enTranslationMessages = require('./translations/en.json');
1513

app/themes/fonts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { css } from 'styled-components';
2-
import { media } from '@app/themes';
2+
import media from '@app/themes/media';
33

44
// sizes
55

app/themes/styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { css } from 'styled-components';
2-
import { colors } from '@app/themes';
2+
import colors from '@app/themes/colors';
33

44
export const configureFlex = (
55
direction = 'row',

internals/webpack/webpack.config.dev.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module.exports = require('./webpack.config.base')({
1313

1414
// Add hot reloading in development
1515
entry: [
16-
require.resolve('react-app-polyfill/ie11'),
1716
'webpack-hot-middleware/client?reload=true',
1817
path.join(process.cwd(), 'app/app.js') // Start with js/app.js
1918
],

internals/webpack/webpack.config.prod.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ const path = require('path');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
44
const WebpackPwaManifest = require('webpack-pwa-manifest');
55
const OfflinePlugin = require('@lcdp/offline-plugin');
6-
const TerserPlugin = require('terser-webpack-plugin');
76
const CompressionPlugin = require('compression-webpack-plugin');
7+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
8+
89
const { isProd, isUAT, getBasePublicPath } = require('../utils');
910

1011
const publicPath = getBasePublicPath();
1112

1213
module.exports = require('./webpack.config.base')({
1314
mode: 'production',
1415
// In production, we skip all hot-reloading stuff
15-
entry: [require.resolve('react-app-polyfill/ie11'), path.join(process.cwd(), 'app/app.js')],
16+
entry: [path.join(process.cwd(), 'app/app.js')],
1617

1718
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
1819
output: {
@@ -22,23 +23,6 @@ module.exports = require('./webpack.config.base')({
2223

2324
optimization: {
2425
minimize: true,
25-
minimizer: [
26-
new TerserPlugin({
27-
terserOptions: {
28-
warnings: false,
29-
compress: {
30-
comparisons: false
31-
},
32-
parse: {},
33-
mangle: true,
34-
output: {
35-
comments: false,
36-
ascii_only: true
37-
}
38-
},
39-
parallel: true
40-
})
41-
],
4226
nodeEnv: 'production',
4327
sideEffects: false,
4428
concatenateModules: true,
@@ -133,6 +117,10 @@ module.exports = require('./webpack.config.base')({
133117
ios: true
134118
}
135119
]
120+
}),
121+
new BundleAnalyzerPlugin({
122+
analyzerMode: 'static',
123+
generateStatsFile: true
136124
})
137125
],
138126
devtool: 'source-map',

jest.config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
".*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/image.js"
4646
},
4747
"setupFilesAfterEnv": ["<rootDir>/jest.setup.js", "<rootDir>/internals/testing/test-bundler.js"],
48-
"setupFiles": ["raf/polyfill"],
4948
"testRegex": "tests/.*\\.test\\.js$",
5049
"snapshotSerializers": []
5150
}

package.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
},
8585
"pre-commit": "lint:staged",
8686
"dependencies": {
87-
"@formatjs/intl-relativetimeformat": "^9.1.6",
8887
"antd": "^5.1.2",
8988
"apisauce": "2.1.1",
9089
"chalk": "4.1.1",
@@ -95,18 +94,18 @@
9594
"express": "4.16.4",
9695
"history": "4.9.x",
9796
"immer": "9.0.3",
98-
"immutable": "^3.8.1",
97+
"immutable": "^4.2.1",
9998
"intl": "1.2.5",
10099
"invariant": "2.2.4",
101100
"ip": "1.1.5",
102101
"less": "^4.1.1",
103102
"less-loader": "7.3.0",
104-
"lodash": "4.17.19",
103+
"lodash-es": "4.17.21",
105104
"minimist": "1.2.3",
106105
"prop-types": "15.7.2",
107106
"react": "18.2.0",
108107
"react-dom": "18.2.0",
109-
"react-intl": "5.20.3",
108+
"react-intl": "6.2.5",
110109
"react-redux": "7.0.2",
111110
"react-router-dom": "^5.1.2",
112111
"redux": "4.0.1",
@@ -144,28 +143,27 @@
144143
"@storybook/react": "^5.2.1",
145144
"@testing-library/jest-dom": "^5.16.4",
146145
"@testing-library/react": "^13.3.0",
147-
"add-asset-html-webpack-plugin": "3.2.0",
146+
"add-asset-html-webpack-plugin": "^5.0.2",
148147
"axios-mock-adapter": "^1.17.0",
149148
"babel-core": "7.0.0-bridge.0",
150149
"babel-eslint": "10.1.0",
151150
"babel-loader": "^8.2.2",
152151
"babel-plugin-dynamic-import-node": "2.3.3",
153152
"babel-plugin-import": "^1.13.3",
154153
"babel-plugin-lodash": "^3.3.4",
155-
"babel-plugin-react-intl": "3.0.1",
156154
"babel-plugin-styled-components": "1.10.0",
157155
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
158156
"cheerio": "^1.0.0-rc.10",
159157
"circular-dependency-plugin": "5.2.2",
160158
"compare-versions": "3.4.0",
161-
"compression-webpack-plugin": "8.0.0",
159+
"compression-webpack-plugin": "^10.0.0",
162160
"coveralls": "3.0.3",
163161
"css-loader": "^5.2.6",
164162
"eslint": "5.16.0",
165163
"eslint-config-prettier": "6.4.0",
166164
"eslint-config-prettier-standard": "^3.0.1",
167165
"eslint-config-standard": "14.1.0",
168-
"eslint-import-resolver-webpack": "0.11.1",
166+
"eslint-import-resolver-webpack": "^0.13.2",
169167
"eslint-plugin-import": "2.18.2",
170168
"eslint-plugin-jest": "^23.2.0",
171169
"eslint-plugin-jsx-a11y": "6.2.1",
@@ -180,8 +178,8 @@
180178
"file-loader": "6.2.0",
181179
"gh-pages": "^3.2.3",
182180
"html-loader": "2.1.2",
183-
"html-webpack-plugin": "5.3.2",
184-
"image-webpack-loader": "7.0.1",
181+
"html-webpack-plugin": "^5.5.0",
182+
"image-webpack-loader": "^8.1.0",
185183
"imports-loader": "3.0.0",
186184
"jest-cli": "27.0.5",
187185
"jest-coverage-badges": "^1.1.2",
@@ -197,7 +195,6 @@
197195
"prettier": "2.3.1",
198196
"prettier-config-standard": "4.0.0",
199197
"prettier-standard": "16.4.1",
200-
"react-app-polyfill": "2.0.0",
201198
"react-floki": "^1.0.70",
202199
"rimraf": "2.6.3",
203200
"shelljs": "0.8.3",
@@ -210,14 +207,14 @@
210207
"stylelint-config-styled-components": "0.1.1",
211208
"stylelint-processor-styled-components": "1.6.0",
212209
"svg-url-loader": "7.1.1",
213-
"terser-webpack-plugin": "5.1.3",
210+
"terser-webpack-plugin": "^5.3.6",
214211
"url-loader": "4.1.1",
215-
"webpack": "^5.40.0",
212+
"webpack": "^5.75.0",
216213
"webpack-bundle-analyzer": "^4.4.2",
217-
"webpack-cli": "4.7.2",
218-
"webpack-dev-middleware": "5.0.0",
219-
"webpack-hot-middleware": "2.25.0",
220-
"webpack-pwa-manifest": "4.3.0",
214+
"webpack-cli": "^5.0.1",
215+
"webpack-dev-middleware": "^6.0.1",
216+
"webpack-hot-middleware": "^2.25.3",
217+
"webpack-pwa-manifest": "^4.3.0",
221218
"whatwg-fetch": "3.0.0"
222219
},
223220
"sideEffects": false

0 commit comments

Comments
 (0)