Facebook Pixel

What does npm run build do?

It creates an optimized, minified production bundle in a build or dist folder. This is what you deploy, not your source files. The build is smaller and faster than the development bundle.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in How to Deploy a React App (Vercel, Netlify, and Firebase Compared)

Run npm run build to create the production bundle, then deploy the build folder to a host like Vercel, Netlify, or Firebase Hosting. Set environment variables in the host's dashboard, and configure SPA routing so deep links work.

Vercel is the easiest default for React apps, with automatic builds on every push, SSL, custom domains, and serverless functions. Netlify is a strong alternative, and Firebase Hosting is natural if you already use Firebase.

In the hosting platform's dashboard, in a settings page for environment variables. Never commit secrets to your repo. Each platform, Vercel, Netlify, Firebase, has a way to set these for production.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.