engineering

Why you should and shouldn’t commit node_modules folder to your repository.

In a fairly recent project after days of thinking I resolved to commit node_modules folder. Well I expect you would think that this man has gone mad, next he’ll say he uses tabs instead of spaces(I do).

Chaitanya Giri 10-12-2019
Share this

My answers to all the questions that might be in your head:

1, Has it been done before?

It’s not an alien concept, people have been doing it ever since it existed due to various reasons.

2, What convinced me?

The reason that convinced me to do is changing the legacy dependencies. When you develop some real life project you often need to change how things work in legacy codebase.

3, Could I have done it the other way?

YES, the other way would involve using a fork of the legacy dependency and pushing the changes to that and using it in the app instead of original.

4, Will I change the way I did it?

MAYBE YES, the constraints for different project varies I felt this part do not deserve that much time currently instead I can focus on some other important part.

5, Any particular downside of committing node_modules?

The downside is that you’ll have a hard time scaling your app horizontally this way also it may happen that some dependencies change in the mean time.Well in my case it is less likely that I’ll need to scale it horizontally in next 6–10 months.

6, Should you do it?

If you don’t have much time, or you won’t need to scale the system in near future then go for it if not consider all the parameters and try some other ways to do it.

Follow me on medium and github for more such articles.

Subscribe to newsletters
Get the updates right in your inbox. We never spam!

Read next

Life- The Good Parts | part one

Let’s establish a healthy relationship between you and life, to do so we’ll have to go through the good parts and the bad ones.

Chaitanya Giri in arts 04-10-2019