我在每个请求上都调用一个函数。我可以从重写中排除/ test目录吗?
{
"hosting":{
"public":"build",
"ignore":[
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites":[
{
"source":"/**",
"function":"helloWorld"
},
{
"source":"**",
"destination":"/index.html"
}
]
},
"functions":{
"predeploy":[
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
}
}
答案 0 :(得分:2)
按照书面规定,由于您有两条**
路线,因此规则重叠的方式没有意义。第二个(指向index.html
)将永远不会被匹配。您可以使用否定来完成您要提出的建议:
{
"rewrites": [
{"source": "!{/test/**}", "function": "helloWorld"}
]
}