I've a very simple typescript firebase function project... the code works and is very simple, but there is something in the project configuration wrong that makes firebase serve
NOT recompile the code before starting the server. at same time firebase deploy
works perfectly
the project sits as
firebase
-.firebaserc
-firebase.json
-functions
--package.json
--tsconfig.json
--src
---...all the code goes here
--built
---...code after compiled goes here
this is the content of firebase.json
{
"functions": [
{
"source": "functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"predeploy": "npm --prefix functions run build"
}
]
}
and this is the content of package.json
{
"name": "functions",
"scripts": {
"build": "tsc",
"build:watch": "tsc --watch",
"clean-build": "for /D %i in (built\\*) do @rd /s /q \"%i\" & del /q built\\*.*",
"serve": "npm run clean-build && npm run build && firebase emulators:start --only functions",
"shell": "npm run clean-build && npm run build && firebase functions:shell",
"start": "npm run clean-build && npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "20"
},
"main": "built/index.js",
"dependencies": {
"axios": "^1.6.8",
"firebase-admin": "^11.8.0",
"firebase-functions": "^4.9.0"
},
"devDependencies": {
"firebase-functions-test": "^3.1.0",
"typescript": "^4.9.0"
},
"private": true
}
if i am INSIDE functions folder and run npm run serve
it works as expected
but if i run firebase serve... it only starts the webserver with the current compiled code, any modifications arent reflected and if the code isn't compiled yet it will fail to start
what can i do to fix this?