Google Cloud / Firebase函数,处理每个函数的依赖关系 [英] Google Cloud / Firebase Functions, handling dependencies per function

查看:129
本文介绍了Google Cloud / Firebase函数,处理每个函数的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些需要大量依赖的函数。我们所谓的jar / npm / lib会继续,并且想限制对函数的依赖,而不是在项目级别。这是可能的吗?



编辑:尝试按照Doug的指示重新修改问题:我们使用Firebase函数,我们希望将函数的依赖关系与其他函数的依赖关系。我们需要版本xyz的依赖关系A为函数1工作,但函数2需要相同的依赖关系A的版本fyz工作。

我怀疑唯一的解决方法是将它部署到另一个项目,但在提交之前想问一个问题。

因此,我们可以在一个Firebase函数中拥有多个版本的相同依赖项部署?



编辑2:将问题的其他部分分开:

答案是否定的,不能控制每个函数的依赖关系,而是每个部署。这是npm本身比Firebase / Google云端函数更多的限制。


We have a couple of functions that require a lot of dependencies to work. We have so called jar/npm/lib hell going on, and would like to limit the dependencies on function, rather than on project level. Is this possible?

Edit: trying to rephrase the question as Doug instructed: We're using Firebase functions and we'd like to isolate the function's dependencies from other function's dependencies. We need version x.y.z of dependency A for function 1 to work, but function 2 needs version f.y.z of the same dependency A to work.

I suspect that the only way around this is to deploy it to another project, but wanted to ask a question here before committing to that.

So, can we have multiple versions of the same dependency in one Firebase Functions deployment?

Edit 2: Divided the other part of the question here: Firebase Functions: is it OK to divide functions to multiple projects

解决方案

The answer is no, one can't control the dependencies per function, but per deployment. This is more of a limitation of npm itself than Firebase / Google Cloud Functions.

这篇关于Google Cloud / Firebase函数,处理每个函数的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆