node.jsbuild

How to 'build' a node js application?


I have a node.js application that run as a application server. It is deployed on an Ubuntu 20.04 machine running on AWS, uses nginx as a reverse proxy and PM2 as a service starter.

Everything seems perfectly configured.

What looks strange to me, is that I have a React application, in a similar environment, but, before to move it on the server, I run build it, so creating a sort of packed and not easily human readable application.

My question is: Is there the need to do the same with a node.js application?

And, in case of positive answer, How to 'build' a node.js application?


Solution

  • There is no need to build a normal nodejs application.

    What you mean is the use of a bundler e.g. webpack and a javascript compiler e.g. babel. To create a react application, you usually use a tool like create-react-app that sets up all this stuff for you. For react you need the compilation beacause you use the jsx syntax that browsers do not understand. In addition to that a bundler has some more advantages.

    Check out this video if you want to know more about it: https://www.youtube.com/watch?v=5IG4UmULyoA