z0g40q
Last Updated: February 25, 2016
·
162
· unframework

Node package.json on a front-end project

For a front-end-only project (where everything is compiled into a pure client-side codebase served off a CDN/static server), NodeJS is frequently used to run various build utilities, tests, etc. To help that setup, there is usually an NPM package.json placed at project root.

That file allows for two kinds of dependencies regular (runtime) and "dev", which are added on top of regular dependencies.

A purist might ask - where do the project module dependencies go?

Well, in the "dev" section. Since a project like this does not have any runtime NodeJS code (it is a pure client-side component, so all the runtime code is browser-based), it can't have runtime dependencies. Simple.

(And yes, that means a giant devDependencies section with an empty dependencies hash.)