Hey hey folks! Just letting you know that we've just shipped a wrangler@beta release which now properly allows you to use Durable Objects with wrangler pages dev.
If you have a Worker service (name-of-service) which defines MyDurableObject, you can run wrangler dev --local as normal. Now, alongside that in another terminal window, you can also run wrangler pages dev ./public --do MY_BINDING=MyDurableObject@name-of-service. They will automatically connect up such that your Remix app now has MY_BINDING which proxies through to the running name-of-service Worker's Durable Object.
This feature is still experimental, so if you find any quirks please file a GitHub issue!
Typically, I'll create a project that looks like this:
app/
routes/
index.tsx
entry.client.tsx
entry.server.tsx
root.tsx
durable_objects/
src/
index.ts
User.ts
package.json
wrangler.toml
public/
favicon.ico
.node-version
package.json
remix.config.js
remix.env.d.ts
server.js
where my durable_objects/wrangler.toml looks something like:
name = "durable-service"
[durable_objects]
bindings = [
{ name = "User", class_name = "User" }
]
And then be running wrangler dev --local in the durable_objects directory and wrangler pages dev ./public --do User=User@durable-service in the root. Let us know how you get on!