change pages functions watch directories in wrangler
When running pages functions locally wrangler watches only the functions directories. Is there a way to make it watch other directories too? [posted by mistake in Workers originally]
3 Replies
were you able to figure out a solution to this?
From the source code of wrangler, it does look like it only watches the
functions
directory: https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/pages/dev.ts#L433 (thanks @pc)
However, I was able to use chokidar-cli
and concurrently
to watch for changes in another source directory (called shared
in my project), and touch one of the files inside functions
to trigger a rebuild.
Here's what the scripts
sections of my package.json
looks like:
NOTE: I'm also using Tailwind CSS to watch and rebuild styles.I haven't. I just put the libraries in ./functions/libs and make sure they do not export onRequest*, so wrangler reloads when the files change
Thanks, I've done the same! Didn't realize that might work. 😅