Skip to content

Commit 6d08477

Browse files
committed
chore(pkg): upgrade devDeps & to webpack 5
1 parent 670aced commit 6d08477

File tree

8 files changed

+1146
-1861
lines changed

8 files changed

+1146
-1861
lines changed

.flowconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[version]
2-
^0.150.1
2+
^0.153.0
33

44
[ignore]
55
.*/node_modules/@babel.*

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### React-Resizable
22

3-
[View the Demo](https://react-grid-layout.github.io/react-resizable/examples/1.html)
3+
[View the Demo](https://react-grid-layout.github.io/react-resizable/index.html)
44

55
A simple widget that can be resized via one or more handles.
66

File renamed without changes.

lib/Resizable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default class Resizable extends React.Component<Props, void> {
139139
// Don't call 'onResize' if dimensions haven't changed.
140140
const shouldSkipCb = handlerName === 'onResize' && !dimensionsChanged;
141141
if (cb && !shouldSkipCb) {
142-
if (typeof e.persist === 'function') e.persist();
142+
e.persist?.();
143143
cb(e, {node, size: {width, height}, handle: axis});
144144
}
145145

lib/ResizableBox.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default class ResizableBox extends React.Component<ResizableBoxProps, Res
4444
onResize: (e: SyntheticEvent<>, data: ResizeCallbackData) => void = (e, data) => {
4545
const {size} = data;
4646
if (this.props.onResize) {
47-
e.persist && e.persist();
47+
e.persist?.();
4848
this.setState(size, () => this.props.onResize && this.props.onResize(e, data));
4949
} else {
5050
this.setState(size);

package.json

+14-15
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
"unit": "jest --watch --verbose",
1010
"build": "bash build.sh",
1111
"build-example": "webpack",
12-
"dev": "webpack-dev-server --open --open-page=examples/1.html",
13-
"watch": "webpack --progress --watch",
12+
"dev": "webpack serve --open",
1413
"prepublishOnly": "npm run build",
1514
"validate": "yarn check",
1615
"preversion": "npm run lint",
@@ -34,32 +33,32 @@
3433
},
3534
"homepage": "https://github.com/react-grid-layout/react-resizable",
3635
"devDependencies": {
37-
"@babel/cli": "^7.14.3",
38-
"@babel/core": "^7.14.3",
39-
"@babel/eslint-parser": "^7.14.4",
40-
"@babel/plugin-proposal-class-properties": "^7.10.4",
41-
"@babel/plugin-proposal-object-rest-spread": "^7.14.4",
42-
"@babel/preset-env": "^7.14.4",
43-
"@babel/preset-flow": "^7.10.4",
44-
"@babel/preset-react": "^7.10.4",
36+
"@babel/cli": "^7.14.5",
37+
"@babel/core": "^7.14.6",
38+
"@babel/eslint-parser": "^7.14.5",
39+
"@babel/plugin-proposal-class-properties": "^7.14.5",
40+
"@babel/plugin-proposal-object-rest-spread": "^7.14.5",
41+
"@babel/preset-env": "^7.14.5",
42+
"@babel/preset-flow": "^7.14.5",
43+
"@babel/preset-react": "^7.14.5",
4544
"babel-loader": "^8.0.6",
4645
"cross-env": "^7.0.2",
47-
"css-loader": "^4.2.2",
46+
"css-loader": "^5.2.6",
4847
"enzyme": "^3.11.0",
4948
"enzyme-adapter-react-16": "^1.15.4",
5049
"eslint": "^7.28.0",
5150
"eslint-plugin-jest": "^24.3.6",
5251
"eslint-plugin-react": "^7.24.0",
53-
"flow-bin": "^0.150.1",
52+
"flow-bin": "^0.153.0",
5453
"jest": "^27.0.4",
5554
"lodash": "^4.17.20",
5655
"pre-commit": "^1.1.2",
5756
"react": "^16.10.2",
5857
"react-dom": "^16.10.2",
5958
"react-test-renderer": "^16.11.0",
60-
"style-loader": "^1.0.0",
61-
"webpack": "^4.44.1",
62-
"webpack-cli": "^3.3.12",
59+
"style-loader": "^2.0.0",
60+
"webpack": "^5.39.0",
61+
"webpack-cli": "^4.7.2",
6362
"webpack-dev-server": "^3.8.2"
6463
},
6564
"dependencies": {

webpack.config.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
const webpack = require('webpack');
22
const path = require('path');
33

4+
const isProduction = process.env.NODE_ENV === 'production';
5+
const isDevelopment = !isProduction;
6+
47
module.exports = {
8+
mode: isProduction ? 'production' : 'development',
9+
bail: isProduction,
510
context: __dirname,
611
entry: {
712
test: "./examples/example.js",
@@ -13,6 +18,7 @@ module.exports = {
1318
library: 'ReactResizable',
1419
libraryTarget: 'umd'
1520
},
21+
target: 'web', // Work around https://github.com/webpack/webpack-dev-server/issues/2758
1622
externals: {
1723
'react': {
1824
'commonjs': 'react',
@@ -30,16 +36,17 @@ module.exports = {
3036
},
3137
module: {
3238
rules: [
33-
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?cacheDirectory=true'},
39+
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader', options: {cacheDirectory: true}},
3440
]
3541
},
3642
resolve: {
3743
extensions: [".js"]
3844
},
3945
devServer: {
40-
contentBase: __dirname,
46+
contentBase: path.join(__dirname, 'examples'),
4147
compress: true,
4248
port: 4003,
49+
hot: true,
4350
},
4451
plugins: [
4552
// Scope hoisting

0 commit comments

Comments
 (0)