我对每个请求都调用一个函数。我可以从重写中排除/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"
]
}
}
正如所写的,您的规则以一种没有意义的方式重叠,因为您有两个**
路由。第二个(指向index.html
(将永远不会匹配。你可以用否定来做你的提议:
{
"rewrites": [
{"source": "!{/test/**}", "function": "helloWorld"}
]
}