Preparing the final production build
We have come a long way to get here. Now is the time when we should look at how we currently run our application and how we should prepare it for a production environment.
Currently, we use our application in a development environment while working on it. It is not highly optimized for performance or low-bandwidth usage. We include developer functionalities with the code so that we can debug it properly.
For use in a real production environment, we should only include what is necessary for the user. When setting the NODE_ENV
variable to production
, we remove most of the unnecessary development mechanics.
By bundling our server-side code, we will get rid of unnecessary loading times and will improve the performance. To bundle our backend code, we are going to set up a new webpack configuration file. Follow these instructions:
- Install the following two dependencies:
npm install --save-dev webpack-node-externals @babel/plugin-transform...