EZPack

EZPackOptions

参数 类型 说明
name string 项目名称
webpack WebpackOptions webpack 相关配置
devServer DevServerOption 开发服务器配置
publish PublishOptions 发布相关配置
disableEntrySelect boolean 禁用start build 模式下的entry选择,默认使用All entry /
sentry { projectName: string; host: { online: string; uat: string; }; token: { online: string; uat: string; }; } sentry 相关配置

WebpackOptions

参数 类型 说明
rootPath string 项目根目录
tsInclude string | string[] tsx?包含的文件目录
jsInclude string | string[] jsx?包含的文件目录
entry webpack.Entry 项目的 entry,等价于 webpack 的 entry
dllEntry webpack.Entry 和上面的 entry 一样,只是存放的是第三方库
outputPath string 打包的文件输出路径
cdnPath string | { uat: string; online: string; } 相当于 webpack 的 public path,只有在打包的时候才会用到。可传一个对象,区分 uat 和 online
cssModulePath CSSPath 配置 css modules 路径
cssGlobalPath CSSPath 配置全局 css 路径
html boolean 项目是否要生成 html 文件
htmlOption HtmlExternalOptions 自定义 html 参数
babelPlugins any[] 自定义的 babel 插件
externals { [key: string]: string | boolean; } webpack 的 externals
plugins any[] 其他需要运行的plugins
splitChunks { [key: string]: any; } 手动指定模块分割方式
version string 打包出来代码的version,理论上来讲可以不用传,为了应对一些js文件 modify 的缓存bug
copyPath { from: string; to?: string; }[] 静态文件复制路径,from 为绝对路径,to 为相对 outputPath 的路径 see https:/github.com/webpack-contrib/copy-webpack-plugin#pattern-properties /
sourceMap boolean 是否生成 source map

HtmlExternalOptions

参数 类型 说明
template string 指定输出的 html 模板,ejs 语法
title string 页面的 title
entryTemplates { [key: string]: string; } map entry 对应 单个输出的 html 模板
preload PreloadOption 自动插入需要preload prefetch 的脚本 /
disableMinify boolean 禁用html代码压缩
customTplData any 自定义数据字段

DevServerOption

参数 类型 说明
port number 开发服务器的端口
defaultProxyOrigin ezmok.OriginSetting 开发模式下默认的接口请求地址
apiDefPath string 接口定义文件根目录路径
initEntry string[] 开发模式初始化编译的 entry
contentBase string | string[] | ServerStaticPath | ServerStaticPath[] 开发服务器的静态文件目录
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 文件的目录名称