flow-build
Version:
483 lines (482 loc) • 17.1 kB
JSON
{
"type": "object",
"additionalProperties": false,
"definitions": {
"common.nonEmptyArrayOfUniqueStringValues": {
"items": {
"description": "A non-empty string",
"minLength": 1,
"type": "string"
},
"minItems": 1,
"type": "array",
"uniqueItems": true
},
"entry": {
"oneOf": [
{
"minProperties": 1,
"additionalProperties": {
"description": "An entry point with name",
"oneOf": [
{
"description": "The string is resolved to a module which is loaded upon startup.",
"minLength": 1,
"type": "string"
},
{
"description": "All modules are loaded upon startup. The last one is exported.",
"anyOf": [
{
"$ref": "#/definitions/common.nonEmptyArrayOfUniqueStringValues"
}
]
}
]
},
"description": "Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.",
"type": "object"
},
{
"description": "An entry point without name. All modules are loaded upon startup. The last one is exported.",
"anyOf": [
{
"$ref": "#/definitions/common.nonEmptyArrayOfUniqueStringValues"
}
]
}
]
}
},
"properties": {
"entry": {
"description": "The entry point(s) of the compilation.",
"anyOf": [
{
"$ref": "#/definitions/entry"
}
],
"default": {
"app": "./src/js/index.js"
}
},
"srcDir": {
"description": "项目源码目录",
"type": "string",
"default": "./src"
},
"dev": {
"description": "开发环境配置",
"type": "object",
"properties": {
"host": {
"description": "开发环境host地址,默认为localhost",
"type": "string",
"default": "localhost"
},
"port": {
"description": "开发环境的端口号,默认为3000",
"type": "number",
"default": 3000
},
"publicPath": {
"description": "开发环境的静态资源cdn地址,默认为/",
"type": "string",
"default": "/"
},
"proxy": {
"description": "开发环境的代理",
"type": "object"
},
"errorOverlay": {
"description": "是否开启webpack-dev-server的overlay配置,默认为{errors:true,warings: false}",
"type": "boolean",
"default": true
},
"poll": {
"description": "是否开启webpack-dev-server的poll配置,默认为false",
"type": "boolean",
"default": false
},
"devtool": {
"description": "webpack的devtool配置",
"anyOf": [
{
"type": "string"
},
{
"enum": [false]
}
],
"default": "eval-source-map"
},
"cssSourceMap": {
"description": "是否生成css的sourceMap配置,默认为false",
"type": "boolean",
"default": false
}
},
"default": {
"host": "localhost",
"port": 3000,
"publicPath": "/",
"errorOverlay": true,
"poll": false,
"devtool": "eval-source-map",
"cssSourceMap": false
}
},
"build": {
"description": "打包环境配置",
"type": "object",
"additionalProperties": false,
"properties": {
"outputPath": {
"description": "打包环境的输出目录地址,默认为./dist",
"type": "string",
"default": "./dist"
},
"assetsSubDirectory": {
"description": "打包后的静态文件子目录",
"type": "string",
"default": "static"
},
"publicPath": {
"description": "打包的静态资源cdn地址,默认为/",
"anyOf": [
{
"type": "string"
},
{
"instanceof": "Function"
}
],
"default": "/"
},
"devtool": {
"description": "webpack的devtool配置",
"anyOf": [
{
"type": "string"
},
{
"enum": [false]
}
],
"default": "#source-map"
},
"cssSourceMap": {
"description": "是否生成css的sourceMap配置,默认为true",
"type": "boolean",
"default": true
}
},
"default": {
"outputPath": "./dist",
"assetsSubDirectory": "static",
"publicPath": "/",
"devtool": "#source-map",
"cssSourceMap": true
}
},
"js": {
"description": "js配置",
"type": "object",
"additionalProperties": false,
"properties": {
"babel": {
"description": "js的babel设置",
"type": "object"
},
"dirname": {
"description": "输出js文件夹名称",
"type": "string",
"default": "js"
},
"hash": {
"description": "输出js文件hash的大小",
"type": "number",
"default": 16
}
},
"default": {
"dirname": "js",
"hash": 16
}
},
"css": {
"description": "css配置",
"type": "object",
"additionalProperties": false,
"properties": {
"engine": {
"description": "css引擎",
"anyOf": [
{
"type": "array"
},
{
"enum": ["css", "less", "sass", "postcss", "stylus"]
}
],
"default": "css"
},
"postcss": {
"description": "postcss配置",
"type": "object"
},
"dirname": {
"description": "输出css文件夹名称",
"type": "string",
"default": "css"
},
"hash": {
"description": "输出css文件hash大小",
"type": "number",
"default": 16
},
"extension": {
"description": "css文件的扩展名",
"type": "array",
"default": []
}
},
"default": {
"engine": "css",
"dirname": "css",
"hash": 16,
"extension": []
}
},
"image": {
"description": "image配置",
"type": "object",
"properties": {
"limit": {
"description": "图片转化base64的条件配置",
"type": "number",
"default": 1000
},
"dirname": {
"description": "输出image文件夹名称",
"type": "string",
"default": "images"
},
"imerge": {
"description": "是否要合图",
"anyOf": [
{
"type": "object"
},
{
"type": "boolean"
}
],
"default": false
},
"hash": {
"description": "输出image文件hash大小",
"type": "number",
"default": 16
}
},
"default": {
"limit": 1000,
"dirname": "images",
"imerge": false,
"hash": 16
}
},
"font": {
"description": "font配置",
"type": "object",
"properties": {
"dirname": {
"description": "输出font文件夹名称",
"type": "string",
"default": "fonts"
},
"hash": {
"description": "输出font文件hash大小",
"type": "number",
"default": 7
}
},
"default": {
"dirname": "fonts",
"hash": 7
}
},
"html": {
"description": "html配置",
"type": "object",
"properties": {
"template": {
"description": "html-webpack-plugin的配置",
"anyof": [
{
"items": {
"description": "A non-empty object",
"minLength": 1,
"type": "object",
"properties": {
"filename": {
"description": "html-webpack-plugin的filename配置",
"type": "string"
},
"path": {
"description": "html-webpack-plugin的template配置",
"type": "string"
},
"excludeChunks": {
"description": "排除entry配置中无关的chunk",
"type": "array"
}
}
},
"minItems": 1,
"type": "array",
"uniqueItems": true
},
{
"description": "html-webpack-plugin的配置",
"type": "object",
"properties": {
"filename": {
"description": "html-webpack-plugin的filename配置",
"type": "string"
},
"path": {
"description": "html-webpack-plugin的template配置",
"type": "string"
}
}
}
]
},
"data": {
"description": "html模板数据映射",
"type": "object"
}
},
"default": {
"template": {
"filename": "index.html",
"path": "./index.html"
}
}
},
"white": {
"description": "白名单配置",
"anyof": [
{
"items": {
"description": "A non-empty object",
"type": "object",
"properties": {
"from": {
"description": "要复制的文件",
"anyof": [
{
"type": "string"
},
{
"type": "array"
}
]
},
"to": {
"description": "目标目录",
"type": "string"
},
"options": {
"description": "复制参数",
"type": "object"
}
}
},
"minItems": 1,
"type": "array",
"uniqueItems": true
},
{
"description": "白名单配置",
"type": "object",
"properties": {
"from": {
"description": "要复制的文件",
"anyof": [
{
"type": "string"
},
{
"type": "array"
}
]
},
"to": {
"description": "目标目录",
"type": "string"
},
"options": {
"description": "复制参数",
"type": "object"
}
}
}
]
},
"mode": {
"description": "项目应用类型,vue/react/multiple/spa/ssr",
"type": "string",
"enum": ["vue", "react", "vue-prerender", "spa", "ssr", "mpvue"],
"default": "spa"
},
"env": {
"description": "项目环境",
"type": "string",
"enum": ["dev", "test", "prod"],
"default": "dev"
},
"alias": {
"description": "webpack的alias",
"type": "object"
},
"extensions": {
"description": "webpack的extensions",
"type": "array"
},
"rules": {
"description": "webpack的rules规则",
"anyof": [
{
"type": "object"
},
{
"type": "array"
}
]
},
"plugins": {
"description": "webpack的plugins插件",
"anyof": [
{
"type": "object"
},
{
"type": "array"
}
]
},
"hooks": {
"description": "flow打包插件",
"type": "array",
"default": []
},
"clean": {
"description": "是否清理掉上次打包的文件夹,默认为true",
"type": "boolean",
"default": true
}
}
}