create-react-app: how to use https instead of http?

后端 未结 19 1129
眼角桃花
眼角桃花 2020-12-24 10:04

I was wondering if anyone knows how to use https on dev for the \'create-react-app\' environment. I can\'t see anything about that in the README or quick googling. I just wa

19条回答
  •  有刺的猬
    2020-12-24 10:51

    Edit your package.json file and change the starting scripts for starting your secures domain. for example https

     {
      "name": "social-login",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        "react": "^16.4.1",
        "react-dom": "^16.4.1",
        "react-facebook-login": "^4.0.1",
        "react-google-login": "^3.2.1",
        "react-scripts": "1.1.4"
      },
      "scripts": {
        // update this line "start": "HTTPS=true react-scripts start",
        "start": "set HTTPS=true&&react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test --env=jsdom",
        "eject": "react-scripts eject"
      }
    }
    

    thanks

提交回复
热议问题