ERROR Could not resolve "cloudflare:workers"
Refactoring our working WebSockets to use Durable Objects with RPC methods.
Using the Durable Object sample to start with no errors or warnings.
But on build:
✘ [ERROR] Could not resolve "cloudflare:workers"
src/durable-objects/testws.do.ts:3:30:
3 │ import { DurableObject } from 'cloudflare:workers'
[@Cloudflare/workers-types 4.2 node v20.17.0 npm 10.8.2 ]
Not sure if this is a package problem or config issue or what..
TIA for any direction
3 Replies
oh interesting.. on 3.74.0 but when I update:
No idea how that devDependency got messed up. Fixed that.
updated to ⛅️ wrangler 3.75.0
same:
✘ [ERROR] Could not resolve "cloudflare:workers"
That was it!
Mad at myself for not trusting the error handling message.
Had to play with DO migrations a bit, but now have a new DO to build out our new WS connection. Very exciting.
Thank you Skye - this was a major roadblock. Should have asked sooner.
How do we satisfy eslint with this import? Is there a cloudflare template that has eslint set up that demonstrates?
eslint doesn't know how to resolve
cloudflare:workers
, so it complains about import { DurableObject } from "cloudflare:workers";
. I just shut it off though and things seem to work fine: