Skip to content

Commit d600404

Browse files
legobeatseaonarekmarks
authored
BREAKING: Bump to webpack 5; support Node.js >= 18 (#264)
* Update dependencies * devdeps: webpack@4.43.0->4.46.0 * fix: set webpack hash function to fix nodejs v18 compatibility * devDeps: webpack@^4.46.0->^5.89.0 - devDeps: webpack-cli@^3.3.12->^5.1.4 - devDeps: webpack-dev-server@^3.11.2->^4.15.1 * yarn deduplicate * ci: run on Node.js v18,v20 * devDeps: @lavamoat/allow-scripts@^2.0.3->^2.5.1 * update allow-scripts config * webpack5 config update * webpack: provide Buffer * fix: work around default-exporting json module See webpack/webpack#13469 * Remove Node 16 support * Disable Webpack dev server overlay --------- Co-authored-by: seaona <mariona@gmx.es> Co-authored-by: Erik Marks <rekmarks@protonmail.com>
1 parent 08e5705 commit d600404

6 files changed

Lines changed: 1454 additions & 3172 deletions

File tree

.github/workflows/build-lint-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-20.04
1212
strategy:
1313
matrix:
14-
node-version: [16.x]
14+
node-version: [18.x, 20.x]
1515
steps:
1616
- uses: actions/checkout@v2
1717
- name: Use Node.js ${{ matrix.node-version }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16
1+
v18

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "7.3.1",
44
"description": "A simple dapp used in MetaMask e2e tests.",
55
"engines": {
6-
"node": ">= 16.0.0"
6+
"node": ">= 18.0.0"
77
},
88
"scripts": {
99
"setup": "yarn install && yarn allow-scripts",
@@ -36,15 +36,15 @@
3636
"homepage": "https://metamask.github.io/test-dapp",
3737
"dependencies": {},
3838
"devDependencies": {
39-
"@lavamoat/allow-scripts": "^1.0.6",
39+
"@lavamoat/allow-scripts": "^2.5.1",
4040
"@metamask/auto-changelog": "^2.5.0",
4141
"@metamask/eslint-config": "^6.0.0",
4242
"@metamask/eslint-config-nodejs": "^6.0.0",
4343
"@metamask/onboarding": "^1.0.0",
4444
"@openzeppelin/contracts": "4.9.3",
4545
"base64-sol": "1.1.0",
46-
"clean-webpack-plugin": "^3.0.0",
47-
"copy-webpack-plugin": "^6.0.2",
46+
"clean-webpack-plugin": "^4.0.0",
47+
"copy-webpack-plugin": "^11.0.0",
4848
"eslint": "^7.29.0",
4949
"eslint-config-prettier": "^8.3.0",
5050
"eslint-plugin-import": "^2.23.4",
@@ -55,17 +55,17 @@
5555
"ethers": "^5.0.32",
5656
"gh-pages": "^3.1.0",
5757
"prettier": "^2.3.1",
58-
"webpack": "^4.43.0",
59-
"webpack-cli": "^3.3.12",
60-
"webpack-dev-server": "^3.11.2"
58+
"webpack": "^5.89.0",
59+
"webpack-cli": "^5.1.4",
60+
"webpack-dev-server": "^4.15.1"
6161
},
6262
"lavamoat": {
6363
"allowScripts": {
6464
"@lavamoat/preinstall-always-fail": false,
65-
"sha3": true,
66-
"secp256k1": true,
67-
"keccak": true,
68-
"fsevents": true
65+
"eth-sig-util>ethereumjs-abi>ethereumjs-util>keccakjs>sha3": true,
66+
"ethereumjs-util>keccak": true,
67+
"ethereumjs-util>secp256k1": true
6968
}
70-
}
69+
},
70+
"packageManager": "yarn@1.22.19"
7171
}

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import {
1010
import { ethers } from 'ethers';
1111
import { toChecksumAddress } from 'ethereumjs-util';
1212
import { getPermissionsDisplayString, stringifiableToHex } from './utils';
13-
import {
13+
import Constants from './constants.json';
14+
15+
const {
1416
hstBytecode,
1517
hstAbi,
1618
piggybankBytecode,
@@ -23,7 +25,7 @@ import {
2325
multisigBytecode,
2426
erc1155Abi,
2527
erc1155Bytecode,
26-
} from './constants.json';
28+
} = Constants;
2729

2830
/**
2931
* Page

webpack.config.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
const path = require('path');
22
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
3+
const { ProvidePlugin } = require('webpack');
34
const CopyPlugin = require('copy-webpack-plugin');
45

56
const DIST = path.resolve(__dirname, 'dist');
67

78
module.exports = {
9+
resolve: {
10+
fallback: {
11+
assert: false,
12+
stream: false,
13+
},
14+
},
815
devtool: 'eval-source-map',
916
mode: 'development',
1017
entry: {
@@ -16,22 +23,34 @@ module.exports = {
1623
publicPath: DIST,
1724
},
1825
devServer: {
19-
contentBase: DIST,
26+
client: {
27+
// This disables the error / warning overlay, which is distracting during
28+
// local development of the test dapp.
29+
overlay: false,
30+
},
31+
devMiddleware: {
32+
writeToDisk: true,
33+
},
2034
port: 9011,
21-
writeToDisk: true,
35+
static: {
36+
directory: DIST,
37+
},
2238
},
2339
plugins: [
40+
new ProvidePlugin({
41+
Buffer: ['buffer', 'Buffer'],
42+
}),
2443
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
2544

2645
// for build scripts
2746
new CopyPlugin({
2847
patterns: [
2948
{
30-
flatten: true,
3149
from: './src/*',
3250
globOptions: {
3351
ignore: ['**/*.js'],
3452
},
53+
to: '[name][ext]',
3554
},
3655
],
3756
}),

0 commit comments

Comments
 (0)