Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use custom build output folder when using create-react-app

Facebook provides a create-react-app command to build react apps. When we run npm run build, we see output in /build folder.

npm run build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes. Your app is ready to be deployed!

How can we use custom folder instead of /build for the output? Thanks.

like image 466
6324 Avatar asked Jan 05 '17 22:01

6324


People also ask

How do I use the build folder in react?

The first thing is to create a new folder and cd into that folder then run the usual npx create-react-app frontend . This is to create a react app and name the folder frontend. Cd into the frontend folder and run npm build . Once the command is done executing you will get a build folder.

Does create react app create a folder?

Create a New React Project To create a new app/project using this tool, all we need to do is run the command "create-react-app" followed by the app name. After running the above command, a new folder called "my-sample-app" will get created and that would have all of our application code.

What does npm build output?

npm run build creates a build directory with a production build of your app. Set up your favorite HTTP server so that a visitor to your site is served index. html , and requests to static paths like /static/js/main.


1 Answers

Edit your package.json:

"build": "react-scripts build && mv build webapp" 
like image 111
Félix Avatar answered Sep 28 '22 04:09

Félix