Repository navigation
fix(deploy): bundle framework Workers with Cloudflare module rules and Worker conditions - #540
Merged
Brooooooklyn merged 3 commits intoOct 22, 2026
Conversation
…d Worker conditions The framework Worker bundle now keeps Wasm, data and text imports as Worker modules, as the Cloudflare Vite plugin does, and resolves dependencies with Worker conditions.
- Emit each Wasm, data or text module once per source file with its own name and extension, so files with the same bytes keep their module type. - Key the external id by a counter, and keep emitted names to safe characters, so quotes in a path no longer break the import string. - Resolve with the 'production' condition, like @cloudflare/vite-plugin, so packages such as esm-env fold their production build. - Replace the reference regex with a small indexOf loop. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21e826bd3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Each build picks a random marker for module ids, so app strings that look like an id are no longer rewritten. - The quoted-name test uses `'` on Windows, which does not allow `"`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Brooooooklyn
approved these changes
Oct 22, 2026
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.
Fixes #539
prepareBundledBuildOutputbundles framework Worker output again with a plain Vite lib build. It now matches@cloudflare/vite-pluginin two ways:.wasmand.wasm?module,.bin,.txt,.htmland.sql, including#subpath imports that resolve to them. Matching imports stay external, and each file is emitted beside the bundle with a path relative to the chunk that imports it.copyBundlealready uploads these files aswasm,dataandtextmodules. The Cloudflare plugin does not export its rules, so the plugin repeats them.WORKER_CONDITIONS, which Void's other Worker bundles already use. The constant moves fromwrapper.tsto its own module so thatcf-build-output.tsstill loads Vite lazily.Both changes apply to every bundle that
prepareBundledBuildOutputbuilds, including the static Worker.Tests
packages/void/test/unit/cf-build-output.test.ts:#subpath import and a dynamic import produceswasm,textanddatamodules and passes thecfdry run.workerdandbrowserexports resolves to itsworkerdbuild.Each test fails when its change is removed.
vp run test,vp run --filter ./packages/void typecheck,vp lintandvp fmt --checkpass.I also prepared the output of a SvelteKit app that uses
@resvg/resvg-wasmand micromark:index_bg.wasmis uploaded as awasmmodule, and the bundle contains the Worker build ofdecode-named-character-reference.Follow-up changes (21e826b, 1cb2d9f)
.,_and-. A quote in a path no longer breaks the import.productioncondition, like@cloudflare/vite-plugindoes for production builds. It is fixed rather than taken fromNODE_ENV, because a deploy bundle is always a production build. Without it, the SvelteKit playground bundle lost the production build ofesm-env.indexOfloop. Each build uses a random marker, so app strings that look like a module id stay as they are.Tests: the Wasm test adds same-bytes
.txt/.binfiles, a quoted file name ('on Windows) and an app string that looks like the old marker; the conditions test adds a package withdevelopment/productionexports.Left out, since they behave the same before this PR (and in
@cloudflare/vite-pluginfor the second):exportsstill prefer thebrowsermain field..wasmsuffix is not kept as a module.🤖 Generated with Claude Code