简体   繁体   中英

Using CI for Bitbucket repository - do I need to have node_modules inside my root folder?

I am trying to Buddy.works using their CI to upload my themes in in test, staging and production mode.

I have noticed when the files are compiled using Webpack that it is also uploading node_modules to the root folder.

It is taking an age to upload everything. Do I really need those files if the build is finished within Webpack?

Normally working on my project locally all node_modules have to be installed in order to use them. Do I need to include the node_modules in the cloud also?

The standard is to not push node_modules to the SCM(Git, SVN, Mercurial) because they take a lot of space. That's why we have package.json . So on a CI/CD tool like Jenkins, Circle CI or Travis you would specify the build to run npm install --production and it would take care of creating and downloading the necessary dependencies to the node_modules folder.

This makes the build faster too as the first step would be something like,

git clone <repo_url>

If you had pushed your node_modules folder it would take longer to clone due to the extra size.

Does this answer your question?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM