a React app using HTTPS for Local Development (localhost) powered by mkcert.
- Clone this repo :
git clone https://github.com/kevinadhiguna/mkcert-reactjs-ssl.git
- Open Terminal and change directory to mkcert-reactjs-ssl :
cd mkcert-reactjs-ssl
- Install dependencies :
yarn
or
yarn install
Note: with npm, it would be :
npm install
- Run the React app :
yarn devStart
Note: with npm, it would be
npm run devStart
Runs the app in the development mode with HTTPS.
Open https://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Go to package.json
and change the script to :
"scripts": {
"devStart":
"set HTTPS=true&&set SSL_CRT_FILE={CERT-PATH}&&set SSL_KEY_FILE={KEY-PATH}&&react-scripts start"
}
"scripts": {
"devSstart":
"HTTPS=true SSL_CRT_FILE={CERT-PATH} SSL_KEY_FILE={KEY-PATH} react-scripts start"
}
Please replace {CERT-PATH}
and {KEY-PATH}
to yours. It will be generated after mkcert localhost
command.