How do multiple people collaborate when using git to manage webpack code? What files are generally hosted?
怪我咯
怪我咯 2017-05-02 09:38:47
0
1
599

Using webpack requires installing many loaders and npm packages. Do I need to upload the node_modules directory when managing git? Is this directory too big? But if it is not uploaded, does everyone involved in the development need to download the loaders themselves?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
淡淡烟草味

Use package.json to manage your npm packages
1. Use npm init to initialize the package.json configuration file when initializing the project; npm init初始化package.json配置文件;
2、package.json里面有两个字段devDependenciesdependencies两个字段分别表示开发环境需要的npm包和部署环境需要的npm包。
3、同步代码的时候大家只需要同步一下package.json文件,然后执行npm install2. There are two fields in package.json The two fields devDependencies and dependencies respectively represent the npm packages required by the development environment and the npm packages required by the deployment environment.
3. When synchronizing code, you only need to synchronize the package.json file, and then execute the npm install command. npm will automatically retrieve the configuration in package.json and install the corresponding node_modules.

Here are the corresponding fields of package.json of one of my projects;

 "dependencies": {},
  "devDependencies": {
    "babel-preset-es2015": "^6.6.0",
    "gulp": "^3.9.1",
    "gulp-babel": "^6.1.2",
    "gulp-concat": "^2.6.0",
    "gulp-connect": "^2.3.1",
    "gulp-minify-css": "^1.2.3",
    "gulp-sass": "^2.1.1",
    "gulp-uglify": "^1.5.1",
    "shelljs": "^0.7.0"
  }

You can see that the npm package name and version number are recorded, which ensures that everyone’s environment is unified. Finally, the person responsible for the basic configuration of the project initializes the project:
  • npm install命令时添加--save,会自动去package.json中的dependenciesUse

    to add the corresponding package name and version.
  • npm install命令时添加--save-dev,会自动去package.json中的devDependenciesUse

    to add the corresponding package name and version.
🎜
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template