npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Separate node_modules directories per "*Dependencies"

This might be naive, but I notice that when deploying (even in CI) environments, that I have to do a npm install and a npm install --production. Why not have separate folders for putting CI vs Production dependencies so that deployment is easier?

I don’t know the best way to do it, but wouldn’t it be nice if a “devDependencies” vs “dependencies” could be installed in separate folders so that I can exclude the devDependency module directory from the distribution? Typically I have build tools as devDependencies and “dependencies” are required modules for the build, so I include the built files and node_modules, but excluding production stuff is a pain and removing node_modules and re-installing with --production seems counterintuitive after building. Even if devDependency folders got prefixed with @dev or were contained inside of a dev dependency folder, that’d be nice.