Skip to content

[vite-plugin] Treat cloudflare:durable-objects as a built-in module - #16452

Open
apeacock1991 wants to merge 1 commit into
mainfrom
apeacock/vite-plugin-durable-objects-module
Open

apeacock1991 wants to merge 1 commit into
mainfrom
apeacock/vite-plugin-durable-objects-module

Conversation

@apeacock1991

@apeacock1991 apeacock1991 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Workers can import retryable() from cloudflare:durable-objects to mark Durable Object methods as safe to retry. The Vite plugin keeps its own list of runtime modules, and this one wasn't on it, so vite build (and cf deploy) failed with:

Rolldown failed to resolve import "cloudflare:durable-objects" from "src/index.ts".

This adds cloudflare:durable-objects to cloudflareBuiltInModules, so Vite leaves the import for workerd. Wrangler already marks every cloudflare:* import as external, and the Vitest plugin falls back to workerd for cloudflare:* builtins, so neither needs a change.

The module-resolution playground now imports retryable and checks it's a function. I ran it in serve and build mode. With the list entry removed, the build variant fails with the error above.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this is a bug fix with no new configuration or API.

Devin Review

Durable Object methods are marked as safe to retry with `retryable()`
from the `cloudflare:durable-objects` runtime module. Add it to the
plugin's built-in module list so Vite leaves the import for workerd
instead of resolving it as a package. Wrangler already treats every
`cloudflare:*` import as external.
@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5fdf3c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin Patch

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Oct 23, 2026
@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team October 23, 2026 22:19
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/vite-plugin-durable-objects-module.md: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/module-resolution/tests/base-tests.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/module-resolution/src/cloudflare-imports.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/cloudflare-environment.ts: [@cloudflare/wrangler]

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ask-bonk

ask-bonk Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@clanky-the-clanker

Copy link
Copy Markdown

✅ Approved — A small, targeted fix that adds cloudflare:durable-objects to the Vite plugin's built-in module list. It includes playground test coverage and a changeset, and no issues were found.

The decision is advisory: this comment never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

The change adds cloudflare:durable-objects to cloudflareBuiltInModules in packages/vite-plugin-cloudflare/src/cloudflare-environment.ts. No other hardcoded list of cloudflare:* modules in the package needs the same entry. The module-resolution playground now imports retryable and asserts that it is a function, which covers the build failure as a regression test. A changeset is included.

This review did not check whether the workerd version the playground uses exports retryable. The new playground assertion depends on it.


📝 Documentation: ✅ LGTM

The changeset accurately describes the fix. No further documentation is needed for this bug fix.


Reviewed commit: 5fdf3c8d

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16452

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16452

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16452

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16452

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16452

create-cloudflare

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

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16452

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16452

@cloudflare/pages-shared

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

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16452

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16452

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16452

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 5fdf3c8

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

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants