Node.js build tools – how about npm?

The JavaScript community is renowned for its vast arsenal of tools to use for, well, for just about anything. This applies also to node.js, there are a plethora of tools that can make your life easier while coding and make you better at it.

Build tools are a crucial factor in creating an app or project, they are important even for running simple test suites. As we said before, the JavaScript ecosystem (that includes Node) is very rich in tools and various forms of “helping hands”. There are a few build tools that are so famous that they’re even integrated in some IDE’s. Worth mentioning in this regard are : WebPack, Brunch or Grunt and Gulp.

The boys in the big leagues are Grunt and Gulp with about half a million downloads a week. Hugely popular and used extensively. They do their job, solving the problem at hand with a few ups and downs. We must mention that using these tools and choosing the right tool depends a lot on your project and your needs. Gulp it’s pretty easy to learn and is very popular because of its flexibility, Grunt is a very good task runner with hundreds of plugins at your disposal.

Although both of them are pretty good build tools, they don’t solve every issue, but their popularity shows that they do work and have a pretty good appeal in the community. But there is another option, a simpler one.

Npm. Yes, this npm. You can use npm as a build tool. Although it may seem like an odd thing to do, it’s a perfectly valid build tool and more than that, it’s a very good build tool. It can actually do everything that Grunt and Gulp can do, but in a more elegant manner, with less maintenance needed. I’m sure there is a lot of resistance and comparisons, a lot of “it’s not meant to be used like that” but if it works for you and your projects, why does it matter?

Npm is an amazing tool, a core tool for the whole Node.js community, most people use it on a daily basis, so why not use it as a build tools as well? Npm grows every day, as new features are being developed and added, but besides the package manager role, npm also has a pretty amazing subset of functionalities for running tasks. You can check out a small tutorial on how to use npm as a built tool here in a blog post by Keith Cirkel.