From fcec689de0288a015bc5c4cfeffa94a289f0a08f Mon Sep 17 00:00:00 2001 From: m31271n Date: Sun, 4 Feb 2018 22:00:19 +0800 Subject: [PATCH] Detail docs about building for relative path --- packages/react-scripts/template/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 2c533d49687..1db44e68914 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -2173,6 +2173,12 @@ To override this, specify the `homepage` in your `package.json`, for example: "homepage": "http://mywebsite.com/relativepath", ``` +Or, specify environment variable named `PUBLIC_URL`, for example: + +```sh + export PUBLIC_URL=http://mywebsite.com/relativepath +``` + This will let Create React App correctly infer the root path to use in the generated HTML file. **Note**: If you are using `react-router@^4`, you can root ``s using the `basename` prop on any ``.