In my React Web Page something about my build is causing it to perform differently from the output of the Build command compared to my Develop command. (Blank screen when use build command). When I use npm run start command the web page is visible and show every content. But when I use npm run build && npx serve -s build some components are not rendering correctly and shows blank page in middle parts.
When using npm run start
When use npm run start command
When using npm run build && npx serve -s build when use npm run build && npx serve -s build
GitHub repository link – GitHub
Why the page is running in localhost but not building? Is there something I missed or need to learn before developing in React? Is it a problem with html or css?
When building this message appear in terminal.
PS D:At Digitalatdigatdigitalnew> npm run build
> [email protected] build
> react-scripts build
Creating an optimized production build...
One of your dependencies, babel-preset-react-app, is importing the
"@babel/plugin-proposal-private-property-in-object" package without
declaring it in its dependencies. This is currently working because
"@babel/plugin-proposal-private-property-in-object" is already in your
node_modules folder for unrelated reasons, but it may break at any time.
babel-preset-react-app is part of the create-react-app project, which
is not maintianed anymore. It is thus unlikely that this bug will
ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
your devDependencies to work around this error. This will make this message
go away.
Compiled successfully.
File sizes after gzip:
50.28 kB buildstaticjsmain.d58e324e.js
2.35 kB buildstaticcssmain.c4187bfa.css
1.77 kB buildstaticjs453.b52634f7.chunk.js
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
serve -s build
Find out more about deployment here:
https://cra.link/deployment
Ashane Arangalla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.