Npm Installing DevDependencies in a Separate Directory

Is there a way to install npm to install devDevpendencies in a separate directory that allows you to run build tasks, excluding devDependencies in a dynamic / simple way?

+5
source share
1 answer

I don't think it is possible, https://www.npmjs.org/doc/files/npm-folders.html states that the modules should be in node_modules .

For your purposes, you can copy everything except the node_modules folder and make npm install --production in the new copied folder, so that there will be only production dependencies in the assembly.

This should do what you want, without much work:

 rsync -av --progress yourproject yourbuilddir --exclude node_modules cd yourbuilddir && npm install --production 
+4
source

Source: https://habr.com/ru/post/1206455/


All Articles