🐛 BUG: `wrangler pages dev` `--live-reload` does not watch static assets
Which Cloudflare product(s) does this pertain to?
Wrangler core, Miniflare
What version(s) of the tool(s) are you using?
[email protected], [email protected]
What version of Node are you using?
21.7.0
What operating system and version are you using?
Linux 6.8.1 (arch linux)
Describe the Bug
Observed behavior
Editing a file served by the pages dev server does not trigger a page reload.
Expected behavior
Page reload on file update.
Steps to reproduce
- create a file (in my case a simple
index.html) - start pages dev server
wrangler pages dev --live-reload [directory] - edit the file
misc
There are comments on the original PR adding the live reload feature mentioning that users are unable to get it to work: #220
Potentially related to #4124 ?
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No errors in browser console or wrangler logs
After a little investigation wrangler seems to only watch files in the functions dir,
e.g: with wrangler pages dev --live-reload dist:
-
touch dist/my-page.htmldoesn't reload/my-page -
touch functions/my-page.tsdoes reload/my-page
That would explain this one too: https://github.com/cloudflare/workers-sdk/issues/4824
Yes, this is surely related, if not a duplicate.
Hi @malobre, thank you for reporting this issue.
You are indeed correct in saying that pages dev does not watch for static assets changes. It currently watches for:
-
/functionsdirectory -
_worker.jsfile/directory -
_routes.json
Triaging this issue and will discuss it as part of the pages dev improvements milestone
this, combined with --live-reload reloading before some build processes finish, makes that feature barely usable
Are there any updates on this? It's a major blocker for smooth development in local environments.
what I've done is run another server&builder, using wrangler only for cloudflare related functions, in my case I use esbuild
what I've done is run another server&builder, using wrangler only for cloudflare related functions, in my case I use esbuild
I know there are endless combinations of services that could be applied to Pages in such a scenario, but if you could provide an example that would be much appreciated.