How can I config the ngix server in production instead of webpack-dev-server?

twitter logo ・1 min read

Hello this is my first post here and i am a beginner in this production type environment, and basically i have no any experiences in any production things. We are working at a project and we have used the webpack-dev-server to serve our webpack build files, and as we know one thing that we shouldn't use "webpack-dev-sever" in production but we are using it because we don't know how to configure properly on standard server like Nginx(we are using "Nginx"). If anyone of you guys have experiences in this field anyhelp o would be really grateful.
I have asked same question in stackoverflow, but couldn't solve issue i am getting with the responses i got. Here is the link to stackoverflow.

https://stackoverflow.com/questions/56585164/webpack-production-issue-reactjs

Thanks.

twitter logo DISCUSS (4)
markdown guide
 

Make sure to generate the static files and serve those, usually a command like npm run build

 

Hello @Micah , how can the 'build/dist' files be served in production ? Any idea ?

 

Since they are static, they can be copied into the document root for your nginx server.

We have many application services running and dependent, so instead of keeping in root folder, we have made a separate folder for frontend, and trying to serve the build files from that directory by typing following command after finishing the build part.

<<
nohup npm run serve &

"build": "webpack --mode production --config webpack.prod.js",
"serv": "webpack-dev-server --mode production --config webpack.prod.js -host dev-test.cc --port 65001"

HERE: serve in the package.json is the script property, i want to ask you question what command should be in this serve line. I have above type of command but it is not helping me in the serve process.

Classic DEV Post from Nov 1 '18

Is Today the Best Time to be a Developer? No...but We're Getting Better.

While working as a developer certainly has its rewards, there are some major issues we need to address.

use4 profile image