使用git管理webpack的代码时多人怎么协作?一般托管哪些文件?
怪我咯
怪我咯 2017-05-02 09:38:47
0
1
594

使用webpack需要安装很多加载器、npm包,git管理的时候需要上传node_modules目录吗?这个目录是不是太大了,但是不上传的话,每个参入开发的人都需要自己去下载那一堆的加载器吗?

怪我咯
怪我咯

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

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