Thomas thomas
Thomas thomas

Reputation: 795

Continuous integration, dist folder and node_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:

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 ?

Upvotes: 7

Views: 6462

Answers (1)

slomek
slomek

Reputation: 5136

You 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.com/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.com/cli/install

Upvotes: 3

Related Questions