admin管理员组文章数量:1289529
I have created react application using create-react-app when I start "npm start" it is running using localhost:3000 in browser which is fine. But, when I click index.html from project folder it is showing blank page. Can you suggest me solutions on how to run react application using index.html file
I have created react application using create-react-app when I start "npm start" it is running using localhost:3000 in browser which is fine. But, when I click index.html from project folder it is showing blank page. Can you suggest me solutions on how to run react application using index.html file
Share Improve this question asked Mar 6, 2021 at 5:27 Abhishek KanugantiAbhishek Kanuganti 1232 silver badges12 bronze badges2 Answers
Reset to default 8Add "homepage": ".",
to the top of your package.json
file. Then build with yarn build
or npm build
. Go to build/
folder and double click on index.html
.
EDIT:
Opening the app via index.html needs
"homepage": "."
inpackage.json
because without it Webpack tries to load the static files from the root the file system rather than build directory. Reference
You can run npm run build
, then go to the “build” folder where a working index.html will be located. The index.html in the project folder isn’t built for production/standalone use.
版权声明:本文标题:javascript - How to run React application by clicking index.html file without any local server - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741464217a2380213.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论