feat(dev): let apps/www run its committed Worker on demand - #859
Merged
Conversation
`next dev` never loads a wrangler `main`, so the two routes www's Worker adds — the cookieless page-view write to Analytics Engine and the MTA-STS policy response — did not exist locally AT ALL. Not "slower to reach": absent, with no way to exercise them short of deploying. Keeping the fast loop as the default is right for a content site, and this does not change it. But "not the default" and "impossible" are different things, and only the first is a trade-off somebody chose. `dev:worker` builds the static export and serves it through the real Worker on the same port. Measured rather than asserted, same request both ways: next dev → GET /.well-known/mta-sts.txt (Host: mta-sts.webhook.co) 404 dev:worker → the same request 200, mode: enforce The build must come first and the test pins that ordering: the Worker serves ./out through its ASSETS binding, so `wrangler dev` against a stale or absent export would serve yesterday's site and look like it had worked. It is also why this cannot be the default — every change needs a rebuild. Derived from the same table as every other dev command, and offered ONLY where the default actually skips the Worker: null for web, whose default is already the OpenNext preview, and null for wrangler apps, which run their main by definition. A second name for something the default already does reads as a capability rather than an option. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BRmGUnxeYsQoG9c8BCZcae
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
next devnever loads a wranglermain, so the two routes www's Worker adds — the cookieless page-view write and the MTA-STS policy response — did not exist locally at all. Not "slower to reach": absent, with no way to exercise them short of deploying.Keeping the fast loop as the default is right for a content site, and this doesn't change it. But "not the default" and "impossible" are different things, and only the first is a trade-off somebody chose.
Measured, not asserted
Same request, both ways:
GET /.well-known/mta-sts.txt(Host:mta-sts.webhook.co)next dev(default)dev:workermode: enforce)Notes
./outvia itsASSETSbinding, sowrangler devagainst a stale export would serve yesterday's site and look like it worked. It's also why this can't be the default.nullfor web (default is already the OpenNext preview) and for wrangler apps (they run their main by definition).Test plan
pnpm lint— 992 pass, 0 fail, exit 0wrangler dev, confirmed the policy route serves; control undernext devreturns 404🤖 Generated with Claude Code