I am getting below error even though I am building using dev environment. Below is my package.json file.
Error: "for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
Package.json file:
"scripts": {
"compile": "webpack",
"start": "node server.js",
"dev": "webpack --mode development",
"build": "webpack --mode production",
"test": "echo \"Error: no test specified\" && exit 1"
},
I do npm run build and then npm run start. Still I am getting the same minified error, I tried to delete bundle.js or ./dist folder and done building in dev environment, still I face the same issue.
Could anyone help me, how can I avoid this minified version and debug the files easily in local?
In the minified production build of React, they avoid sending down full error messages. Instead, we can use the error code to view the full message for full errors and additional helpful warnings. This small tool is meant to mitigate this gap.
#185 text: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
You need to import without curly brackets in the case of export default: export default class MyInput extends React. Component { ... } import MyInput from './MyInput.
Remove any comment inside render
/ return
method
I used this regex in VSCode to find the troublesome comments: (\s*\n?\s*//
More help here
The error description is here, you return nothing as result of render
method of you react component. Return something else instead of it.
In case it helps someone, I resolved this problem by returning null instead of false (my function is wrapped inside an HOC)
Edit: sometimes I did not want to render anything. In such case, I returned false in the render method as something like this:
render(){
return condition && <ThingsIWantToDisplay/>; //condition is a boolean
}
The component class is then wrapped within an HOC (to provide React Context) like this:
export default HOC(Component);
When condition
is false
, an error occurs in the production build.
Changing the render function as shown below alleviated the problem:
render(){
return condition?<ThingsIWantToDisplay/>:null; //condition is a boolean
}
I have the same issue check your useState import
import { useState } from 'react/cjs/react.production.min';
change into
import react,{usestate} from 'react'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With