0

What does the firebase client need to upload the firebase functions? All I can identify is that it takes my files from my lib directory, does something to them, and then uploads everything. Does it take my dependencies also? How does this work?

The reason I'm asking is that I'm trying to use firebase functions with kotlin-js. Kotlin-js natively integrates with webpack, and can integrate with npm dependencies. I can give firebase a single file with all dependencies integrated, but it doesn't seem like firebase is uploading dependencies. It seems like maybe the package.json is being sent up or something.

If I compile to kotlin-js, what portions of my code/dependencies should I put in my lib folder to be uploaded?

spierce7
  • 14,797
  • 13
  • 65
  • 106

1 Answers1

4

The CLI uploads everything in the functions folder, except for node_modules. That will be rebuilt on the server by running npm install. There's not really enough information here to understand what you ought to be doing, but everything that's needed at runtime needs to be in the functions folder.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • This is helpful - so if I just have webpack output a single js file with all my dependencies, throw that in my `lib` folder, paired with a dummy `package.json` file, I should be good to go? – spierce7 Feb 18 '20 at 17:59
  • If that one file contains **everything** you need, and it exports all your functions, then it should be OK. – Doug Stevenson Feb 18 '20 at 18:12
  • Hey, do I require an index.js file as the starting file? I'm still kind of new to all of this. – spierce7 Feb 18 '20 at 20:30
  • Yes, you should probably just follow the template that was created for you by firebase init. – Doug Stevenson Feb 18 '20 at 20:31