-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[workers-utils] Fix compat date resolution in workspaces #11910
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: a9be9bb The changes in this PR will be included in the next version bump. 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 |
petebacondarwin
left a comment
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.
Nice little trick!
| // Note: this works because Wrangler depends on `miniflare` (and therefore `workerd`) | ||
| // in the monorepo. | ||
| const wranglerPackageJson = fileURLToPath( | ||
| new URL("../../wrangler/package.json", import.meta.url) | ||
| ); |
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.
I'm a bit worried that this is brittle due to relying upon the relative location of the wrangler package compared to this file. But I guess it is only in a test and if it changes the test will break and we'll know to change it.
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
getLocalWorkerdCompatibilityDate()could fail in workspaces because it usedrequire.resolve("miniflare"), andminiflare’smainpoints atdist/(which may not exist until built). That caused the function to fall back even thoughworkerdis installed.This change:
miniflare/package.jsoninstead, so resolution works even beforeminiflareis built@cloudflare/workers-utilsCommands run:
pnpm checkpnpm test:ci --filter @cloudflare/workers-utilsPublic documentation
A picture of a cute animal (not mandatory, but encouraged)
/_/\
( o.o )