I am deploying a React app but am getting a strange error when I visit the page over https.
When I visit the page over https I receive the following error:
S
For folks waiting for react-scripts for a patch:
For local testing over https, you can manually edit
node_modules/react-dev-utils/webpackHotDevClient.js
Here's the code you'll want at line 62 of that file:
protocol: window.location.protocol === 'https:' ? 'wss' : 'ws',
For deployment follow below steps:
npm install -g serve // This can be done locally too
npm run build
And Then in your package.json add a deploy script to work with serve:
"scripts": {
"deploy": "serve -s build",
}
And then
npm deploy or yarn deploy
Hope this answer helps you get rid of the error.
For more info refer to here`
This bug has been fixed in the latest version of the release. Click here to see the source file