Skip to content

[miniflare] Serve local assets with workerd's native assets service - #16932

Draft
ry wants to merge 1 commit into
mainfrom
ry/miniflare-workerd-assets
Draft

ry wants to merge 1 commit into
mainfrom
ry/miniflare-workerd-assets

Conversation

@ry

@ry ry commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Serves local static assets with workerd's native assets service (cloudflare/workerd#8475) instead of Miniflare's own copies of the production Workers.

A Worker's assets become one workerd service. It routes each request to the User Worker or to a file, and sends the User Worker every other event (RPC, scheduled, tail), so the router, asset and assets-KV Workers, the RPC proxy in front of them and the Sentry stub are deleted: +166 −663 lines, of which 105 added lines are the generated AssetsService config types. Miniflare no longer walks the assets directory to build a manifest at startup, and files changed while it runs are served immediately. run_worker_first and .assetsignore are still validated when Miniflare starts. The asset count and size limits are no longer checked locally; wrangler deploy still checks them.

Draft until a workerd release includes the service. The generated config types gain only AssetsService, hand-trimmed from a regeneration against the pinned workerd plus the new schema; they will be regenerated against that release. Tests pass against a local workerd build (MINIFLARE_WORKERD_PATH).

@changeset-bot

changeset-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fb3fc4f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
miniflare Minor
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

},
],
compatibilityDate: "2026-01-01",
modules: [{ name: "assets.js", bundled: "/workerd/assets.js" }],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Update workerd in this PR before enabling this module.

The checked-in catalog and lockfile still resolve workerd@1.20261113.1, while this bundled module is only available from the unreleased workerd change described in the PR. With the dependencies in this branch, every Miniflare instance configured with assets will fail to load /workerd/assets.js at startup. Once the release is available, update the catalog/lockfile and regenerate the config bindings in the same change so the committed test suite runs against a runtime that provides this module.

@ask-bonk

ask-bonk Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Switches Miniflare static assets to workerd’s bundled assets Worker.

  1. P1: Posted 1 inline merge-blocking finding.

github run

@pkg-pr-new

pkg-pr-new Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16932

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16932

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16932

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16932

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16932

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16932

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16932

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16932

miniflare

npm i https://pkg.pr.new/miniflare@16932

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16932

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16932

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16932

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16932

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16932

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16932

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16932

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16932

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16932

wrangler

npm i https://pkg.pr.new/wrangler@16932

commit: fb3fc4f

@ry
ry force-pushed the ry/miniflare-workerd-assets branch from ba0c7bc to 02d106b Compare November 15, 2026 21:24
@ry ry changed the title [miniflare] Serve local assets with workerd's assets Worker [miniflare] Serve local assets with workerd's native assets service Nov 15, 2026
Miniflare no longer runs its own copies of the router, asset and
assets-KV Workers, nor the RPC proxy in front of them, and no longer
walks the assets directory to build a manifest at startup. A Worker's
assets are one workerd `assets` service, which routes each request to
the User Worker or to a file and sends the User Worker every other
event (RPC, scheduled, tail). `env.ASSETS` binds its `AssetWorker`
entrypoint.

`_headers`, `_redirects` and `.assetsignore` are passed to the service
as text, and `run_worker_first` and `.assetsignore` are still validated
when Miniflare starts. The asset count and size limits are no longer
checked locally. The read-only test now covers Workers Sites only:
assets have no disk service to write to.

The config types are regenerated from the pinned workerd schema plus
the new `AssetsService`, and will be regenerated again against the
workerd release that includes it.
@ry
ry force-pushed the ry/miniflare-workerd-assets branch from 02d106b to fb3fc4f Compare November 16, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

1 participant