Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Firebase云函数的TypeScript引用?_Typescript_Firebase_Google Cloud Functions - Fatal编程技术网

如何使用Firebase云函数的TypeScript引用?

如何使用Firebase云函数的TypeScript引用?,typescript,firebase,google-cloud-functions,Typescript,Firebase,Google Cloud Functions,我的Firebase项目都是TypeScript。我有一个corelib,用于在我的云功能和Web应用程序之间共享一些代码。作为npm包维护core开始变得非常麻烦,因为为了在代码中做一个小的更改并在部署中测试它,我必须构建库、升级版本、发布它,等等。因此,我决定迁移到 我的目录结构类似于: ./functions ./webapp ./lib ./core 然后functions有一个tsconfig.json文件,其中包含: "references": [ {

我的Firebase项目都是TypeScript。我有一个
core
lib,用于在我的云功能和Web应用程序之间共享一些代码。作为npm包维护
core
开始变得非常麻烦,因为为了在代码中做一个小的更改并在部署中测试它,我必须构建库、升级版本、发布它,等等。因此,我决定迁移到

我的目录结构类似于:

./functions
./webapp
./lib
  ./core
然后
functions
有一个
tsconfig.json
文件,其中包含:

"references": [
   {"path": "../lib/core"}
]
使用
tsc--build
构建
函数
项目是可行的,但是构建的
*.js
函数文件中对核心的依赖性最终是:

const core_1 = require("../../../lib/core");
因此,在
firebase--deploy
之后,firebase会抱怨:

⚠  functions[testFunction(us-central1)]: Deployment error.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
我想这是因为这个要求

我已经研究过在引用中使用
prepend:true
,但我不知道这是否会适得其反,因为我的
core
项目依赖于
firebase函数
和其他firebase lib

有没有办法让
tsc
将引用的项目引入
dist
(输出目录)的结构中