Skip to content

Static

静态服务

属性名类型默认值描述
assetsstring"public"作为公共路径暴露的资源路径
prefixstring'/public'用于为静态目录创建虚拟挂载路径的路径前缀
staticLimitnumber1024如果总文件数超过此数字,文件将通过通配符处理而不是静态路由,以减少内存使用
alwaysStaticbooleanfalse (除非 NODE_ENV 为 'production')文件是否始终以静态方式提供
ignorePatterns`Array<stringRegExp>`[]
noExtensionboolean-指示是否需要文件扩展名,仅在 alwaysStatic 设置为 true 时有效
enableDecodeURIboolean-当 URL 需要解码时使用,仅在 alwaysStatic 设置为 false 时有效
resolve(...pathSegments: string[]) => string-Node.js 解析函数
headers`Record<string, string>undefined`-
noCachebooleanfalse如果设置为 true,浏览器缓存将被禁用
directive`'public''private''must-revalidate'
maxAge`numbernull`86400
indexHTMLbooleantrue启用将 index.html 作为默认路由的服务