EZPack

EZPackOptions

参数 类型 说明
name string 项目名称
webpack WebpackOptions webpack 相关配置
publish PublishOptions 发布相关配置

WebpackOptions

参数 类型 说明
rootPath string 项目根目录
tsInclude string | string[] tsx?包含的文件目录
jsInclude string | string[] jsx?包含的文件目录
entry webpack.Entry 项目的 entry,等价于 webpack 的 entry
dllEntry webpack.Entry 和上面的 entry 一样,只是存放的是第三方库
devPort string devServer 端口
outputPath string 打包的文件输出路径
cdnPath string | { uat: string; online: string; } 相当于 webpack 的 public path,只有在打包的时候才会用到。可传一个对象,区分 uat 和 online
cssModulePath CSSModulePath 使用 css module 的路径 默认不会对 node_modules 里面的 css 文件进行处理
html boolean 项目是否要生成 html 文件
htmlOption HtmlPluginOption 自定义 html-webpack-plugin 参数
babelPlugins any[] 自定义的 babel 插件
externals { [key: string]: string | boolean; } webpack 的 externals
devServer DevServer 开发服务器的相关配置

CSSModulePath

参数 类型 说明
include string | string[] 要使用 css module 的路径,用绝对路径
exclude string | string[] 要禁用 css module 的路径,用绝对路径

HtmlPluginOption

参数 类型 说明
title string 页面的 title
filename string 输出的 html 文件名称,支持 [name] entry 名字
template string 模板的路径,支持 [name] entry 名字

DevServer

参数 类型 说明
port string 开发服务器的端口
contentBase string | string[] 开发服务器的静态文件目录
staticOptions serveStatic.ServeStaticOptions 静态目录相关配置

ServeStaticOptions

参数 类型 说明
dotfiles string Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). Note this check is done on the path itself without checking if the path actually exists on the disk. If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny"). The default value is 'ignore'. 'allow' No special treatment for dotfiles 'deny' Send a 403 for any request for a dotfile 'ignore' Pretend like the dotfile does not exist and call next()
etag boolean Enable or disable etag generation, defaults to true.
extensions string[] Set file extension fallbacks. When set, if a file is not found, the given extensions will be added to the file name and search for. The first that exists will be served. Example: ['html', 'htm']. The default value is false.
fallthrough boolean Let client errors fall-through as unhandled requests, otherwise forward a client error. The default value is false.
index string | true | false | string[] By default this module will send "index.html" files in response to a request on a directory. To disable this set false or to supply a new index pass a string or an array in preferred order.
lastModified boolean Enable or disable Last-Modified header, defaults to true. Uses the file system's last modified value.
maxAge string | number Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the ms module.
redirect boolean Redirect to trailing "" when the pathname is a dir. Defaults to true. /
setHeaders (res: express.Response, path: string, stat: any) => any Function to set custom headers on response. Alterations to the headers need to occur synchronously. The function is called as fn(res, path, stat), where the arguments are: res the response object path the file path that is being sent stat the stat object of the file that is being sent

PublishOptions

参数 类型 说明
onlinePath string 线上静态文件的仓库(比如 ezstatic)路径
uatPath string uat 静态文件的仓库(比如 localezstatic)路径
uatEnv string[] uat 对应的多套环境的名称,对应多个静态目录,比如 dgamin.65emall.net,dgadmin2.65emall.net
uatMapName string[] uat 对应的多个 map 文件的名称,比如 aspirin 项目的 env1-map.js,env2-map.js
mapDir string 保存上面多个 map 文件的目录名称