Pat*_*kkx 6 javascript firebase google-cloud-functions firebase-cli
大卫在他的回购中:
https://github.com/davideast/react-ssr-firebase-hosting
具有firebase功能的文件index.js在主根目录中,而不是在/functions目录中.
但是,如果我这样做并将我的index.js文件放到主根,如果我这样做firebase deploy --only functions,请在控制台中说:
i deploying functions
Error: functions\index.js does not exist, can't deploy Firebase Functions
Run Code Online (Sandbox Code Playgroud)
问:他怎么可能让它发挥作用?我怎么能这样做并从其他目录成功部署功能/functions?
谢谢
firebase.json
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"function": "ssrapp"
}
]
},
"functions": {
"source": "/"
}
}
Run Code Online (Sandbox Code Playgroud)
Dou*_*son 19
使用Firebase CLI创建的项目工作区包含一个名为firebase.json的文件,该文件具有云函数的节,如下所示:
"functions": {
"predeploy": [
"npm --prefix $RESOURCE_DIR run lint"
],
"source": "functions"
}
Run Code Online (Sandbox Code Playgroud)
该"source"属性定义包含将在Cloud Functions上运行的代码的文件夹的名称.您可以将其更改为您想要的任何内容.
小智 10
如果你想用你的根目录作为您的文件夹功能,只需改变你的source钥匙.在你的firebase.json。
"functions": {
"source": ".",
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
Run Code Online (Sandbox Code Playgroud)
这将index.js在根目录中查找您的文件(记住将所有其他文件也移动到您的根目录)。
文档:https : //firebase.google.com/docs/functions/manage-functions#deploy_functions
| 归档时间: |
|
| 查看次数: |
3247 次 |
| 最近记录: |