Skip to content

Commit

Permalink
Upgrade miniflare to 2.0.0 🎉 (#221)
Browse files Browse the repository at this point in the history
* chore: upgrade `miniflare` to `2.0.0`

* fix: remove redundant immediate `pages dev` rebuilds/reloads

Watching `all` events without `ignoreInitial` set to `true` means
`chokidar` will call the callback immediately. This caused functions
to be built twice, and Miniflare to be `reload`ed immediately after
startup.

* fix: wait for `esbuild` to finish before starting Miniflare

Instead of using a `scriptReady` boolean, this now uses a deferred
`Promise`, so the event loop isn't blocked. This is `await`ed before
constructing the `new Miniflare`, as this will asynchronously kick
off loading the script.

* fix: undefined fallback fetch on watch update with `pages dev`

Subsequent Pages Functions worker builds due to file changes were
not replacing `__FALLBACK_SERVICE_FETCH__` leading to
`ReferenceError`s. This change switches to using `esbuild`'s built-in
`define` option, instead of `esbuild-plugin-replace`, removing an
additional dependency.
  • Loading branch information
mrbbot authored Jan 11, 2022
1 parent a979d55 commit 8ff5537
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 261 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-knives-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Upgrade `miniflare` to `2.0.0`
Loading

0 comments on commit 8ff5537

Please sign in to comment.