Skip to content

Conversation

@ksawaneh
Copy link

@ksawaneh ksawaneh commented Jan 14, 2026

getLocalWorkerdCompatibilityDate() could fail in workspaces because it used require.resolve("miniflare"), and miniflare’s main points at dist/ (which may not exist until built). That caused the function to fall back even though workerd is installed.

This change:

  • Resolves miniflare/package.json instead, so resolution works even before miniflare is built
  • Updates the unit test to use Wrangler’s workspace context for resolution
  • Adds a changeset for @cloudflare/workers-utils

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:

Commands run:

  • pnpm check

  • pnpm test:ci --filter @cloudflare/workers-utils

  • Public documentation

    • Cloudflare docs PR(s):
    • Documentation not necessary because: no user-facing behavior/docs change (internal resolution fix + tests)

A picture of a cute animal (not mandatory, but encouraged)

/_/\
( o.o )

^ <

@ksawaneh ksawaneh requested a review from a team as a code owner January 14, 2026 09:52
@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest 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

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice little trick!

Comment on lines +12 to +16
// 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)
);
Copy link
Contributor

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.

@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 14, 2026
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jan 14, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 14, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11910

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11910

miniflare

npm i https://pkg.pr.new/miniflare@11910

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11910

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11910

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11910

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11910

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11910

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11910

wrangler

npm i https://pkg.pr.new/wrangler@11910

commit: a9be9bb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

2 participants