Would you happen to know what this would look like on Windows? I see mkcert works fine on Windows..
UPDATE:
I have this working on Windows using mkcert & customize-cra
config-overrides.js
constfs=require('fs');constpath=require('path');const{overrideDevServer}=require('customize-cra');constconfigureHttps=()=>config=>{return{...config,https:{key:fs.readFileSync(path.resolve(__dirname,'./localhost+2-key.pem')),cert:fs.readFileSync(path.resolve(__dirname,'./localhost+2.pem')),},};};/* config-overrides.js */module.exports={devServer:overrideDevServer(// dev server pluginconfigureHttps()),};
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I did implement this in CRA yesterday with no need for ejecting.
3 steps:
mkcert localhost
cat ~/.localhost-ssl/localhost-key.pem ~/.localhost-ssl/localhost.pem > {cra-path}/cert/server.pem
and then in package.json
"prestart": "cp -f ./cert/server.pem ./node_modules/webpack-dev-server/ssl || :",
Oh nice, thanks!
Can I add this snippet to the blog post and cite you as well?
Of course! :)
nice hook.
Would you happen to know what this would look like on Windows? I see mkcert works fine on Windows..
UPDATE:
I have this working on Windows using
mkcert
&customize-cra
config-overrides.js