react-resize-aware
react-resize-aware copied to clipboard
Upgrade 3.x Error: TypeError: n is not a function
After upgrading from 2.7.0 to 3.1.0, I get a show-stopping error:
TypeError: n is not a function
push../node_modules/react-resize-aware/dist/index.js.module.exports
E:/Project/node_modules/react-resize-aware/dist/index.js:54
51 |
52 | module.exports = function (n) {
53 | void 0 === n && (n = r);
> 54 | var u = e.useState(n(null)),
55 | o = u[0],
56 | i = u[1],
57 | c = e.useCallback(function (e) {
Truncated call chain:
renderWithHooks
...
mountIndeterminateComponent
...
beginWork
...
HTMLUnknownElement.callCallback
I have been doing some other upgrades, but I've confirmed React 16 -> 17 doesn't seem to make a difference, react-scripts 3 -> 4, etc.
Full package.json:
{
"name": "my-app",
"version": "1.0.4",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.1.9",
"animejs": "^3.2.1",
"bootstrap": "^5.0.2",
"collections": "^5.1.12",
"css-loader": "^5.2.6",
"express": "^4.17.1",
"immutable": "^4.0.0-rc.14",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-bootstrap": "^1.6.1",
"react-dom": "^17.0.2",
"react-draggable": "^4.4.3",
"react-resize-aware": "3.1.0",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.1",
"react-zdog": "^1.0.11",
"serve": "^12.0.0",
"socket.io": "^2.3.0",
"style-loader": "^3.0.0",
"uuid": "^8.3.2"
},
"scripts": {
"webpack": "webpack --production",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"engines": {
"node": "12.16.1"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/register": "^7.14.5",
"babel-plugin-css-modules-transform": "^1.6.2",
"file-loader": "^6.2.0",
"webpack-cli": "^4.7.2",
"zdog": "^1.1.2"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"css-modules-transform"
]
}
}
Thoughts:
My babel might be a little funky? Although my babel.config.json
has sourceType: 'unambiguous'
and it seems like it transpiles fine. If I had to guess some other dependency might be interfering with it, but I have seen this error in the past. I think it was due to that modules.export and import/export difference but could be wrong. Any help would be appreciated, thank you.