Do you have commit webpack generated files?

Viewed 4390

I started using webpack with my node application recently. However, the application generates a huge file in client/dist/js/app.js and commiting that file everytime takes quite a bit of time. I imagine, that as my web application keeps growing, its going to get even worse.

The question is, since you can always run npm run bundle, which will run webpack locally and generate all the required files, do you actually have to commit the entire directory generated by webpack? Is it considered good or bad practice doing that?

1 Answers

Your file is a minified javascript generated from your source code by webpack. You must not include these generated files from the dist folder in your repository since they will be overwritten every time you run webpack after changes has been made to your source files.

Remove this directory from your repository and write dist/ in a .gitignore file to avoid adding it again next time.

Related