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

后端 未结 19 1379
眼角桃花
眼角桃花 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 11:01

    set HTTPS=true&&react-scripts start in scripts > start: of package.json as shown below.

    "scripts" in package.json:

    "scripts": {
        "start": "set HTTPS=true&&react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
    
    • Please don't leave any space in between the commands i.e, HTTPS=true && npm start won't work.

    Refer it in official doc. Using HTTPS in Development

    (Note: the lack of whitespace is intentional.)

提交回复
热议问题