带有env-cmd和gh-pages的CRA在部署后具有错误的代码路径

时间:2020-01-08 00:07:14

标签: create-react-app github-pages

我正在尝试解决类似的问题-部署env-cmd的CRA gh-pages。问题是当我从

切换时
"build": "react-scripts build",

"build:staging": "env-cmd -f .env.staging react-scripts build",

已部署版本的某些源代码路径错误。 例如-代替路径

https://surfer19.github.io/green-roofs/img/green-building-top.jpg

https://surfer19.github.io/img/green-building-top.jpg

我的env.staging包含

REACT_APP_API_URL=http://surfer19.github.io/green-roofs/

"homepage": "http://surfer19.github.io/green-roofs/"中将其切换到package.json时,它可以正常工作。

任何想法可能在哪里出现问题?

0 个答案:

没有答案