-
Notifications
You must be signed in to change notification settings - Fork 734
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
Upgrade miniflare
to 2.0.0
🎉
#221
Conversation
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.
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.
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.
🦋 Changeset detectedLatest commit: 41d6df0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stamping this to unblock. Feel free to merge if you'd like. (Else I'll do it Monday first thing)
Landing this! |
Hey! 👋 This PR upgrades
miniflare
to version2.0.0
. There were only a couple changes since2.0.0-rc.5
, mostly around makingfetch
behave more like Cloudflare's. See the bottom of the changelog.I've also made another few minor tweaks to
pages dev
:all
events withoutignoreInitial
set totrue
meanschokidar
calls the callback immediately. This caused functions to be built twice, and Miniflare to bereload
ed immediately after startup.scriptReady
boolean, this now uses a deferredPromise
, so the event loop isn't blocked. This is nowawait
ed before constructing thenew Miniflare
, as this is what asynchronously kicks off loading the script. It looks like this wasn't doing anything before though, sincescriptReady
was initialised totrue
.ReferenceError: __FALLBACK_SERVICE_FETCH__ is not defined
on watch update withpages dev
: subsequent Pages Functions worker builds due to file changes were not replacing__FALLBACK_SERVICE_FETCH__
leading toReferenceError
s (I think this is a bug inesbuild-plugin-replace
). This change switches to usingesbuild
's built-indefine
option, instead ofesbuild-plugin-replace
, removing an additional dependency.cc @GregBrimble