Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Any way to separate production from dev dependencies in node_modules in npm 3? #9674

Description

@mhart

We currently check in our production dependencies to git (which allows us to git checkout a full working version of our app on our production machines), and we don't check in our dev dependencies.

Until npm@3 we've been able to specify our dev dependency directories in our .gitignore:

node_modules/**/.bin
node_modules/browserify
node_modules/watchify

There's a duplication here with what's listed in package.json and ideally there'd be a single line we could ignore (eg node_modules_dev or something), but up until npm@3 it wasn't too bad.

The issue under npm@3 is we have literally hundreds of packages at the top level that need to be ignored – and worse, I worry that we may ignore some only to have them needed for a production dependency down the track.

node_modules/**/.bin
node_modules/browserify
node_modules/watchify
node_modules/acorn
node_modules/ansi-green
node_modules/ansi-wrap
node_modules/anymatch
node_modules/arr-diff
node_modules/arr-flatten
node_modules/array-filter
node_modules/array-map
node_modules/array-reduce
node_modules/array-slice
node_modules/array-unique
node_modules/arrify
node_modules/asn1.js
node_modules/assert
node_modules/astw
node_modules/async-each
node_modules/balanced-match
node_modules/base64-js
node_modules/binary-extensions
node_modules/bn.js
node_modules/brace-expansion
node_modules/braces
node_modules/brorand
node_modules/browser-pack
node_modules/browser-resolve
node_modules/browserify-aes
node_modules/browserify-rsa
node_modules/browserify-sign
node_modules/browserify-transform-tools
node_modules/browserify-zlib
node_modules/buffer-xor
node_modules/buffer
node_modules/builtin-status-codes
node_modules/builtins

Etc...

Is there anything we can do about this? Any npm command that I might be missing that will help us out? Any way to separate production from dev dependencies?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions