Open alexpchin opened 1 year ago
eval('require') is used instead of just 'require' because when the code is packed, webpack (vercel/ncc) will include all of the required source code in every single transpiled function, increasing cold start time.
I have not yet had a chance to investigate Firebase Function's compatibility with the new esm 'import' statements, which might defeat the purpose of the entire optimisation. I need time to investigate further on this.
When you say setup function, do you mean initializeApp()
that's used to create Firestore etc... instances?
As this package uses eval('require') does that mean that a singleton created every time the function gets executed? We're having a problem with a setup function being called lots of times in the app and we're wondering if this library may cause the problem by the way it requires files?