Skip to content

Commit cd09351

Browse files
committed
Upgrade to webpack 5
Without this, `yarn dev` worked but `yarn build` errored with ERROR in devtools.js from Terser Error: error:0308010C:digital envelope routines::unsupported
1 parent f643bde commit cd09351

File tree

3 files changed

+615
-2687
lines changed

3 files changed

+615
-2687
lines changed

package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,24 @@
2323
"@types/rsocket-core": "^0.0.6",
2424
"@types/rsocket-types": "^0.0.2",
2525
"@types/rsocket-websocket-client": "^0.0.3",
26-
"clean-webpack-plugin": "^3.0.0",
27-
"copy-webpack-plugin": "^6.2.1",
28-
"css-loader": "^5.0.1",
26+
"clean-webpack-plugin": "^4.0.0",
27+
"copy-webpack-plugin": "^12.0.2",
28+
"css-loader": "^6.9.1",
2929
"devtools-protocol": "^0.0.852555",
3030
"file-loader": "^6.2.0",
31-
"html-loader": "^1.3.2",
32-
"html-webpack-plugin": "4.5.1",
31+
"html-loader": "^5.0.0",
32+
"html-webpack-plugin": "^5.6.0",
3333
"node-sass": "^9.0.0",
34-
"sass-loader": "^10.1.1",
35-
"style-loader": "^2.0.0",
36-
"ts-loader": "^8.0.14",
34+
"sass-loader": "^14.0.0",
35+
"style-loader": "^3.3.4",
36+
"ts-loader": "^9.5.1",
3737
"typescript": "^4.1.3",
3838
"url-loader": "^4.1.1",
39-
"webpack": "^4.42.1",
40-
"webpack-cli": "^4.3.1"
39+
"webpack": "^5.90.0",
40+
"webpack-cli": "^5.1.4"
4141
},
4242
"dependencies": {
43+
"buffer": "^6.0.3",
4344
"classnames": "^2.2.6",
4445
"flexsearch": "0.7.21",
4546
"mobx": "^6.1.6",

webpack.common.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@ module.exports = {
1111
devtools: path.join(__dirname, "src/devtools.ts"),
1212
inspector: path.join(__dirname, "src/inspector.tsx"),
1313
},
14-
output: {
15-
path: path.join(__dirname, "dist"),
16-
filename: "[name].js"
17-
},
1814
module: {
1915
rules: [
2016
{
2117
test: /\.css$/,
22-
loader: "style-loader!css-loader",
18+
use: ["style-loader", "css-loader"],
2319
exclude: /node_modules/
2420
},
2521
{
@@ -38,8 +34,11 @@ module.exports = {
3834
// loads the icon to the dist directory
3935
{
4036
test: new RegExp('\.(' + fileExtensions.join('|') + ')$'),
41-
loader: "file-loader?name=[name].[ext]",
42-
exclude: /node_modules/
37+
exclude: /node_modules/,
38+
loader: "file-loader",
39+
options: {
40+
name: '[name].[ext]'
41+
}
4342
},
4443
{
4544
exclude: /node_modules/,
@@ -58,13 +57,13 @@ module.exports = {
5857
patterns: [
5958
{
6059
from: "src/manifest.json",
61-
transform: function (content, path) {
62-
// generates the manifest file using the package.json informations
63-
return Buffer.from(JSON.stringify({
60+
transform: function (input, path) {
61+
// generates the manifest file using the package.json information
62+
return JSON.stringify({
6463
description: process.env.npm_package_description,
6564
version: process.env.npm_package_version,
66-
...JSON.parse(content.toString())
67-
}));
65+
...JSON.parse(input.toString())
66+
});
6867
}
6968
}
7069
]

0 commit comments

Comments
 (0)