“firebase serve” in firebase functions is not running the latest changes


I am playing with firebase functions. Works fine when deploying to firebase server using command firebase deploy --only functions. However, I would like to test my functions locally before deploy to server of course. What I see running firebase serve is that the functions “deployed” locally have not the latest changes I did in indext.ts – are running the last builded version, which are in index.js.

My question is, How do I manual build my firebase functions project to test them locally with latest changes?
Should firebase serve autobuild the project before deploy it locally? For me, it sounds like a bug.

Answered question

If you want to reload the changes to your TypeScript when running firebase serveor,firebase functions:shell all you have to do is build your project again using npm script that was created for you when you initialized the project (see package.json):

This will transpile your TypeScript to JavaScript, and the changes to the JavaScript will get picked up by the emulator automatically.

Also, if you are a more advanced TypeScript user, you can run tsc --watch to automatically compile TS to JS when source files change on disk. You can read more about that in this blog.

Edited answer
You are viewing 1 out of 1 answers, click here to view all answers.