Projects that use create-react-app display a blank space after build?

< H2 > problem description < / H2 >

react can start normally after npm run start
react cannot be displayed on the packaged page after npm run build

< H2 > Project build < / H2 >

use of scaffolding: create-react-app

Project address: https://github.com/tuihou1233.

normal page display:

clipboard.png

Page displayed after build:
error prompt:

Navigated to http://localhost:63342/react-activity/build/index.html?_ijt=5htlhrvs0b3epm9e42sn97dvb3
registerServiceWorker.js:42 This web app is being served cache-first by a service worker. To learn more, visit https://goo.gl/SC7cgQ
Mar.28,2021

create-react-app scaffolding is the root path by default. You can find in node_modules that the 45 lines of react-scripts/config/paths.js, in the file'/ 'change to'. /', or directly add homepage


to package.json to open the control panel, which should prompt you that the js path is incorrect. You can add an option homepage:'./' in package.json , and then re- npm run build

.
Menu