Add sandbox support to @cloudflare/vite-plugin#12794
Merged
edmundhung merged 2 commits intocloudflare:mainfrom Mar 12, 2026
Merged
Add sandbox support to @cloudflare/vite-plugin#12794edmundhung merged 2 commits intocloudflare:mainfrom
edmundhung merged 2 commits intocloudflare:mainfrom
Conversation
🦋 Changeset detectedLatest commit: ab86cd5 The changes in this PR will be included in the next version bump. 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 |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
3 tasks
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
0308fea to
1da9549
Compare
0c86c5e to
8df5356
Compare
jamesopstad
approved these changes
Mar 10, 2026
Contributor
jamesopstad
left a comment
There was a problem hiding this comment.
Looks great! Thanks @aron-cf.
6eef425 to
66e0d45
Compare
1a4724f to
51481aa
Compare
This commit ensures that all websocket requests (including those that use the vite-hmr protocol) are routed to the worker. This fixes a minor issue where the plugin will drop HMR requests from sandbox preview URLs. The handler now checks to see if the host matches the pattern used by sandboxes. `<port>-<sandbox_id>-<token>.localhost`. The URL provided to the `dispatchFetch` call also now correctly includes the origin where previously it would just use `http://localhost` as a placeholder. This was breaking the `proxyToSandbox()` call in the worker itself.
51481aa to
db2b6a4
Compare
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers |
edmundhung
reviewed
Mar 12, 2026
Co-authored-by: Edmund Hung <me@edmund.dev>
edmundhung
approved these changes
Mar 12, 2026
Merged
aron-cf
added a commit
to cloudflare/sandbox-sdk
that referenced
this pull request
Mar 12, 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.
This commit ensures that all websocket requests (including those that
use the vite-hmr protocol) are routed to the worker. This fixes a minor
issue where the plugin will drop HMR requests from sandbox preview URLs.
The handler now checks to see if the host matches the pattern used by
sandboxes.
<port>-<sandbox_id>-<token>.localhost.The URL provided to the
dispatchFetchcall also now correctly includesthe origin where previously it would just use
http://localhostas aplaceholder. This was breaking the
proxyToSandbox()call in the workeritself.