Webpack: Should I build the package on a production server or build it locally and then upload?

I am deploying a React application on AWAS Elastic Beanstalk. I am linking the application using webpack. However, I am a little confused about which best practices relate to the process of creating production. Should I create the application locally (using NODE_ENV = production) using webpack and then just upload the resulting bundle.js file along with all the node_modules to an Elasticbeanstalk instance? Or should I download all source files and run webpackon the actual AWS server during deployment?

+4
source share
2 answers

You should not create local products (unless you are a developer).

Ideally, you have a build process that starts manually or automatically from the git commit, which then creates a production project for you.

Using a centralized build process, you can be sure that all of your builds are built the same way (for example, the same version node, the same version, npmor yarn).

+2
source

Both approaches are not very good to be honest. Local construction is not the best way to build everything you want to have in production. You may have local packages that may be relevant to what you are building. The same applies to the OS on which you are doing this.

. "", . , , .

, CI/CD. , . , , "desing" - , , .

, ( ), CI/CD , shell script Docker , . CI/CD, .

+1

Source: https://habr.com/ru/post/1685309/


All Articles