DEV Community

Discussion on: Deploy ReactJS Production Build with PM2

Collapse
earthboundmisfit profile image
Muzammil • Edited on

This is equivalent to running the application, only thing is we use pm2 to run it. Is there a way to deploy the build file of the react application using pm2 ? This way would have browser compatibility issues if I'm not wrong.

In order to deploy the react build file:-
Step 1:

npm run build

Step 2:

pm2 serve build/ 3000 --name "react-build" --spa

The "react-build" is just an alias name for the pm2 process. "--spa" is optional as well. "build/" is the folder in which the build files are stored