-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 BUG: wrangler dev does not watch for source changes when using a custom build command #631
Comments
Thanks for this @jahands. The problem is that while Wrangler can trigger the custom build, it does not know what the inputs to that build are, so it doesn't know when to restart the build. I think this will come down to good migration documentation rather than a fix on the Wrangler side of things. For simple cases, where the custom build was literally just bundling the code (as in your excellent reproduction) the new Wrangler 2 builtin bundling will do that for you and watch and rerun as necessary, so a custom build step is not needed. For more complex cases, such as in a Pages Remix project, one should set up the build as a separate process that does its own watching of its input files, and then |
Ah fair enough - if I do something custom I should expect to need my own watcher/autobuilder. +1 for a doc for people moving from this configuration + miniflare - it wasn't clear why standalone miniflare watched files when using a custom build and wrangler dev didn't. |
Setting build.watch_dir should make this work How does miniflare know which folder to watch? |
Ah I forgot about |
I'm still curious to know how miniflare does it, we should totally steal that. |
Isn't Miniflare just runnin esbuild under the hood? |
From the
...so Miniflare implicitly watches the |
TIL! Damn we should check what else we've missed. |
Via wrangler 1, when using custom builds in `wrangler dev`, `watch_dir` should default to `src` of the "project directory" (i.e - wherever the `wrangler.toml` is defined if it exists, else in the cwd. Fixes #631
Via wrangler 1, when using custom builds in `wrangler dev`, `watch_dir` should default to `src` of the "project directory" (i.e - wherever the `wrangler.toml` is defined if it exists, else in the cwd. Fixes #631
Via wrangler 1, when using custom builds in `wrangler dev`, `watch_dir` should default to `src` of the "project directory" (i.e - wherever the `wrangler.toml` is defined if it exists, else in the cwd. Fixes #631
What version of
Wrangler
are you using?0.0.19
What operating system are you using?
MacOS
Describe the Bug
Running
wrangler dev
with a custom build command doesn't watch files for changes and rebuild/reload like Miniflare does.Steps to reproduce:
Clone this repo: https://github.com/jahands/wrangler-dev-example
git clone git@github.com:jahands/wrangler-dev-example.git
cd wrangler-dev-example
npm install
npx wrangler dev --local
npx miniflare --live-reload
The
wranger.toml
uses some deprecated fields, but I also included a second wrangler.toml namedwrangler-non-deprecated-example.toml
which has no deprecated fields, and it still doesn't work.(version with deprecated fields used here because miniflare doesn't work with the non-deprecated version.)
The text was updated successfully, but these errors were encountered: