Open jason0518 opened 6 years ago
I've solved this issue locally with node-watch
. Same API call, minimal change:
require('node-watch').(localdir, {
recursive: true
}, (event, filename) => {
This worked for me, here are full instructions and a fix for @ribizli's small typo:
@google-cloud
directory, probably in your node_modules
(see below for Firebase)cd functions-emulator
npm install --save node-watch
src/supervisor/worker.js
fs.watch(localdir, {
. Replace this with require('node-watch')(localdir, {
. Using Firebase with typescript, all I have to do is run tsc -w
in a separate terminal (the watch variant of npm run build
). I can now change my source code and the emulator will notice the changes.
If you installed firebase
globally, you can find these files by navigating to cd $(npm root -g)/firebase-tools/node_modules/@google-cloud
.
Environment details
Steps to reproduce
Possible solution
src/supervisor/worker.js#L172
to watch a single file in your project (vs the recursive option) then it works as expected. If you checkout the Node docs there is a caveat for this as the recursive option only works on Mac or Windows.