最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Continuous integration, dist folder and node_modules - Stack Overflow

programmeradmin0浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 3

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./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

发布评论

评论列表(0)

  1. 暂无评论