wrangler-legacy icon indicating copy to clipboard operation
wrangler-legacy copied to clipboard

`wrangler preview --watch` broken with custom build config

Open diced opened this issue 3 years ago • 3 comments

🐛 Bug report

Describe the bug

It seems that with a custom build configuration like below, when running wrangler preview --watch it just exits instead of watching for any changes when the watch_dir is set to the current directory. It works with other directories, yet putting one file in a directory to make that work seems overkill.

[build]
command = "yarn build"
watch_dir = "."
upload = { format = "service-worker" }

yarn build: esbuild index.js --bundle --outfile=dist/index.js

Reproduce the bug

A list of steps to reproduce the bug.

  1. Set up a wrangler project
  2. Add esbuild to dev dependencies
  3. Copy the build script above to package.json scripts.build
  4. Add the custom build config to wrangler.toml
  5. Run wrangler preview --watch

Expected behavior

It should just watch for changes instead of exiting with the --watch flag, yet seems to behave like it would without it.

Environment and versions

Fill out the following information about your environment.

  • operating system: Arch Linux x86_64 (Kernel: 5.13.10-zen1-1-zen)
  • output of wrangler -V: wrangler 1.19.0
  • output of node -v: v16.3.0
  • content of wrangler.toml:
name = "weather"
type = "javascript"

account_id = "x"
workers_dev = true

routes = [
  "edge.diced.me/weather*",
  "edge.diced.me/weather"
]

zone_id = "x"

[build]
command = "yarn build"
upload = { format = "service-worker" }

diced avatar Aug 22 '21 16:08 diced

@diced - thanks for the report. are you able to use wrangler dev instead?

nilslice avatar Aug 24 '21 15:08 nilslice

Uh no, it errors out with this image And it can't be anything with my code since its not erroring when building

diced avatar Aug 24 '21 16:08 diced

This issue has been automatically marked as stale because it has not had recent activity in the last 180 days. It will be closed if no further activity occurs in the next week. Please feel free to comment if you'd like it to remain open, and thank you for your contributions.

stale[bot] avatar Mar 02 '22 09:03 stale[bot]

Thanks for reporting this issue! Wrangler v1 is now deprecated and support is only being provided for critical updates or security concerns. As such, we are closing this issue. New versions of Wrangler are maintained in the workers-sdk repo. If you are running into a similar issue with wrangler v2, please report it in the workers-sdk repo. For more info about wrangler v1 deprecation, please check out our blog post.

jspspike avatar Feb 27 '23 16:02 jspspike