Home  >  Article  >  Web Front-end  >  Detailed introduction to package.json file configuration

Detailed introduction to package.json file configuration

零下一度
零下一度Original
2017-06-17 10:35:211518browse

This article mainly introduces the detailed explanation of package.json file configuration, which has certain reference value. Interested friends can refer to it.

package.json is a configuration file automatically generated in the root directory of the project after the npm init command is initialized. It defines the configuration information of this project and the various required modules. npm install automatically downloads the required modules according to this command. package.json is a json file. json itself is just a data format. It does not support comments . The comments here are just for easier understanding of each field of package.json


{ 
//项目名称 
“name”: “demo”, 
//version是版本(遵守“大版本.次要版本.小版本”的格式) 
“version”: “1.0.0”, 
//description描述你的模块,或者搜索 
“description”: “vue.js js iview “, 
//main字段指定了加载的入口文件 
“main”: “app.js”, 
// scripts指定了运行脚本命令的npm命令行缩写,比比如start指定了运行npm run start时,所要执行的命令。 
“scripts”: { 
“start”: “node index.js” 
}, 
//repository(仓库)指定一个代码存放地址 
“repository”: { 
“type”: “git”, 
“url”: “git+https://github.com/XXXX” 
}, 
“author”: “mayuan”, 
“license”: “ISC”, 
“bugs”: { 
“url”: “https://github.com/XXXX” 
}, 
// 一个字符串数组,方便别人搜索到本模块 
“keywords”: [ 
“vue”,”iview” 
], 
“entry”:{ 
“main”: “./web/index.js” 
}, 
//项目主页url 
“homepage”: “https://github.com/XXXX“, 
//devDependencies指定项目开发所需要的模块 
“devDependencies”: { 
“babel-core”: “^6.23.1”, 
“babel-loader”: “^6.3.2”, 
“babel-preset-es2015”: “^6.22.0”, 
“vue-html-loader”: “^1.0.0”, 
“vue-loader”: “^8.5.2”, 
“vue-style-loader”: “^1.0.0”, 
“webpack”: “^1.13.2” 
}, 
//dependencies字段指定了项目运行所依赖的模块 
“dependencies”: { 
“underscore”: “^1.8.3”, 
“vue”: “^2.1.4” 
}, 
}

The above is the detailed content of Detailed introduction to package.json file configuration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn