更新时间:2021-11-24 21:19:22
这里有很多答案确实可以解决问题,但是自从我问这个问题以来,我找到的最简单的方法是添加npm包
A lot of answers here do actually solve the issue but the simplest way I have found since I asked this question is to add npm package serve to your dependencies.
yarn add serve
或npm i serve
,然后将启动脚本替换为以下内容:
and then replace your start script with the following:
"scripts": {
"start": "serve -s build",
}
这实际上是从create-react-app docs
This is actually straight out of the create-react-app docs