T
TanStack•2mo ago
absent-sapphire

Error importing `cloudflare:workers`

I am trying to use a Cloudflare Durable Object in development. This requires import { DurableObject } from "cloudflare:workers";, which fails with the following error:
Error: Cannot find module 'cloudflare:workers' imported from '<path/to/sourcefile>`
Error: Cannot find module 'cloudflare:workers' imported from '<path/to/sourcefile>`
5 Replies
absent-sapphire
absent-sapphireOP•2mo ago
This is on version 1.128.1 with target: "cloudflare-module"
absent-sapphire
absent-sapphireOP•2mo ago
I've created an issue + minimal repro here: https://github.com/TanStack/router/issues/4687
GitHub
Can't find module "cloudflare:workers" when using `target: 'cloudfl...
Which project does this relate to? Start Describe the bug Create a project with target: &#39;cloudflare-module&#39; and add a CloudFlare durable object class. I have created a minimal repo based on...
absent-sapphire
absent-sapphireOP•2mo ago
If anyone knows where in the code to start, I would love to help fix this
magic-amber
magic-amber•2mo ago
I'm facing this right now and my fix was this. It took an hour to get to this point, what a pain 😣
No description
magic-amber
magic-amber•2mo ago
The error only shows on the frontend logs, not on server logs. And it says Uncaught TypeError: error loading dynamically imported module I've also put it in the issue

Did you find this page helpful?