If the other answers aren't working for you, there's also a homepage
field in package.json
. After running npm run build
you should get a message like the following:
The project was built assuming it is hosted at the server root.
To override this, specify the homepage in your package.json.
For example, add this to build it for GitHub Pages:
"homepage" : "http://myname.github.io/myapp",
You would just add it as one of the root fields in package.json
, e.g.
{
// ...
"scripts": {
// ...
},
"homepage": "https://example.com"
}
When it's successfully set, either via homepage
or PUBLIC_URL
, you should instead get a message like this:
The project was built assuming it is hosted at https://example.com.
You can control this with the homepage field in your package.json.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…