Google Cloud / Firebase函数,处理每个函数的依赖关系 [英] Google Cloud / Firebase Functions, handling dependencies per function
问题描述
编辑:尝试按照Doug的指示重新修改问题:我们使用Firebase函数,我们希望将函数的依赖关系与其他函数的依赖关系。我们需要版本xyz的依赖关系A为函数1工作,但函数2需要相同的依赖关系A的版本fyz工作。
我怀疑唯一的解决方法是将它部署到另一个项目,但在提交之前想问一个问题。
因此,我们可以在一个Firebase函数中拥有多个版本的相同依赖项部署?
答案是否定的,不能控制每个函数的依赖关系,而是每个部署。这是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屋!