I want to publish an npm package for use in cloudflare projects that includes a pre-written durable

I want to publish an npm package for use in cloudflare projects that includes a pre-written durable object. End users would install the package, add a couple lines to their
wrangler.jsonc
(unless there is a magic way to not do this step) — and viola they have this particular durable object working.

I have 2 questions:

  1. This import
    import { DurableObject } from "cloudflare:workers";
    assumes
    cloudflare:workers
    can be resolved, but of course that is only importable with a build tool like vite. Should I bundle cloudflare:workers as an internal dependency? What would the CF team recommend?
  2. How does the
    class_name
    property of wrangler's config work? Can it resolve a class that is in a dependency?
Was this page helpful?