Let's say I have a JS file called policies.js
and both my Firebase Cloud Functions (and other server object libraries) and Client Web App should comply to the same object interface defined in this policies.js
file. Secondly, I also want the object interface to be made available to VSCode's intellisense when developing my client-side web app.
But according to Firebase docs here:
The code for this local module should be stored somewhere other than the node_modules folder within your function's root directory.
In order to make the objects in policies.js
accessible by the client web app, I also need to place it inside my hosting folder called scripts
so that I can reference it like:
<script src="/scripts/policies.js"></script>
I was thinking: Is there a way to share this policies.js
file between Cloud Functions and Client Web App without duplicating and storing it in two different places? There is a similar answer here but the answer does not take into consideration the environmental scope requirements of Firebase Functions. Any ideas/feedback/best practices are welcome! Thanks a lot!