diff --git a/docusaurus/docs/using-https-in-development.md b/docusaurus/docs/using-https-in-development.md index 3541e356b8e..425bdbc4b19 100644 --- a/docusaurus/docs/using-https-in-development.md +++ b/docusaurus/docs/using-https-in-development.md @@ -32,7 +32,7 @@ HTTPS=true npm start Note that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page. -To avoid having to set the environment variable each time, you can either include in the `npm start` script like so: +To avoid having to set the environment variable each time, you can include it in the `npm start` script like so: ```json { @@ -40,5 +40,13 @@ To avoid having to set the environment variable each time, you can either includ } ``` -Or you can create a `.env` file with `HTTPS=true` set. +However, this will only work on Linux and macOS (Bash), as Windows defines the environment variables differently. You can use [`cross-env`](https://www.npmjs.com/package/cross-env) to overcome this issue. The package provides a seamless way of defining cross-platform environment variables through the CLI. After installing `cross-env` through your favourite package manager, you can use it to include the environment variable in the `npm start` script like so: + +```json +{ + "start": "cross-env HTTPS=true react-scripts start" +} +``` + +Alternatively, you can create a `.env` file with `HTTPS=true` set. [Learn more about environment variables in CRA](https://create-react-app.dev/docs/adding-custom-environment-variables).