I have a problem with local test functions in typescript. Now, I used npm run build && firebase serve --only functions
to run local functions, but every change I made on the code, I need to run this command again to see the result. I want to view real-time change without having to build the typescript code every time. Is there a solution to this problem?
Asked
Active
Viewed 1,432 times
4

Pongsaphol Pongsawakul
- 153
- 1
- 7
2 Answers
11
The Firebase emulator will pick up changes to JavaScript automatically while it's running. Since you're using TypeScript, you will have to compile to JavaScript in order for the emulator to pick up the change. You have two main choices:
- Run
npm run build
again after each change - Tell the TypeScript compile to "watch" your source files and compile them whenever there is a change. You can do that with
npx tsc --watch
.

karel
- 5,489
- 46
- 45
- 50

Doug Stevenson
- 297,357
- 32
- 422
- 441