For anybody else that s interested after

For anybody else that's interested, after some further investigation, I can confirm that these docs are incorrect. If you deploy _routes.json , even when using advanced mode (_worker.js), you do not need to serve static assets using env.ASSETS.fetch -- it's done for you.
1 Reply
Rich
Rich8mo ago
However it's worth pointing out that wrangler pages dev doesn't handle _routes.json out the box, so for local development you do need to serve assets, I just kept it simple and did this:
if (process.env.NODE_ENV == "development") {
// It turns out that in development, we do still need to serve assets manually...
const asset = await env.ASSETS.fetch(request);
if (asset.status !== 404) {
return asset;
}
}
// handle worker request
if (process.env.NODE_ENV == "development") {
// It turns out that in development, we do still need to serve assets manually...
const asset = await env.ASSETS.fetch(request);
if (asset.status !== 404) {
return asset;
}
}
// handle worker request
i.e. we don't care about performance so much during local development so can ignore the routing logic in _route.json.