I m actually studying continuous integration and I m actually facing a (little) problem when dealing with the build sequence of the process.
Actually, I have an application that has the following directory at the root of the project:
- src
- doc
- dist
- tests
- node_modules
My question is : when I m at the building step (building the last artifact to put in production, after testing process) should I copy the node_modules directory inside of the dist folder ? So this dist folder could work in standalone (with minification etc... etc...) and so I have only to deploy this folder in my prod environnement ?
How can I move only "dependencies" modules and not "devDependencies" modules ?
I m actually studying continuous integration and I m actually facing a (little) problem when dealing with the build sequence of the process.
Actually, I have an application that has the following directory at the root of the project:
- src
- doc
- dist
- tests
- node_modules
My question is : when I m at the building step (building the last artifact to put in production, after testing process) should I copy the node_modules directory inside of the dist folder ? So this dist folder could work in standalone (with minification etc... etc...) and so I have only to deploy this folder in my prod environnement ?
How can I move only "dependencies" modules and not "devDependencies" modules ?
Share Improve this question asked Oct 17, 2015 at 9:12 Thomas thomasThomas thomas 7952 gold badges9 silver badges19 bronze badges 1- Is this a server-side Node.js application or a client application (just using node_modules as dependencies)? I am not sure if minification is even necessary for a server-side Node.js application... – Nitax Commented Mar 3, 2016 at 22:45
1 Answer
Reset to default 3You don't need to copy anything, because Node when you require
a module within your Node app, it will search for node_modules
in current directory, and if the dependency is not found, it will try to search in its parent and so on.
Check out how Node looks for a package here: http://mycodesmells./post/node-basics-looking-for-package/
If you don't want to have development dependencies in your production environment, you can install only non-dev ones:
npm install --production
Source: https://docs.npmjs./cli/install