Conversation
Create a fetchable mini-oxygen SSR environment using Vite 8's environment APIs and move runtime lifecycle management into a dedicated environment module. Keep Hydrogen and CLI option passing compatible via registerPluginOptions while routing dev requests through server.environments.ssr and preserving build-time compatibility_date handling. Update the custom workerd module runner bridge for Vite 8's invoke contract, including getBuiltins support and fetchModule options forwarding, so local SSR still runs inside MiniOxygen. Upgrade workspace Vite dependencies to v8, switch example/template configs to native resolve.tsconfigPaths, and add the environment API refactor plan document. Co-authored-by: Codex <codex@openai.com>
Replace mini-oxygen's custom /__vite_fetch_module bridge with a service binding that forwards Vite runner invoke payloads to the SSR environment's built-in handleInvoke() path. This removes bespoke request parsing and builtins serialization while keeping the current fetchable SSR environment and Hydrogen/CLI runtime option flow intact. Co-authored-by: Codex <codex@openai.com>
Drop the leftover unused Hydrogen plugin lookup in dev, and switch MiniOxygen and bundle analyzer asset emission to emitFile() so Vite 8/Rolldown no longer warns about mutating the bundle object. Co-authored-by: OpenAI Codex <codex@openai.com>
Align CLI internal MiniOxygen typing with monorepo source types, make the bundle analyzer tolerate Vite 8 and Rolldown RenderedModule typing, and fix MiniOxygen proxy port parsing strictness. Co-authored-by: OpenAI Codex <codex@openai.com>
Drop the leftover __VITE_ROOT runtime binding from the MiniOxygen Vite worker bridge now that the Vite 8 Environment API path no longer uses it. Co-authored-by: OpenAI Codex <codex@openai.com>
Throw on late runtime reconfiguration, remove the refactor plan doc, and add coverage for MiniOxygen's Vite environment lifecycle. Co-authored-by: OpenAI Codex <codex@openai.com>
- Upgrade vitest from ^1.0.4 to ^3.2.4 in packages/cli (only package still on v1, which only supports Vite ^5) - Update build test assertions to match Vite 8 renamed log messages Co-Authored-By: Claude <noreply@anthropic.com>
Three bugs were preventing HMR from working after the migration to Vite's Environment API: 1. `server.watch: null` (accidentally introduced in #2722) caused Vite to create a NoopWatcher, so no file-change events were ever emitted. Removed it to restore chokidar. 2. The SSR environment was passed `transport: context.ws` (the same WebSocket server the browser uses). Because `isWebSocketServer` is true on that object, Vite used it directly as the SSR environment's hot channel. When the SSR module graph found no React Fast Refresh boundaries (SSR code has none), it sent `full-reload` over that shared WebSocket — hard-refreshing the browser on every file change. Dropping the transport gives the SSR environment a noop hot channel so those events are silently discarded. 3. `@vite/client` was never injected into HTML responses from workerd, so the browser never established a WebSocket connection to Vite's HMR server. React Router's <Scripts /> already injects the inject-hmr-runtime preamble; the only missing piece was @vite/client. Now injected via a simple string replace on HTML responses. Server-side invalidation (route handlers, server.ts) is handled by a new watcher listener in environment.ts: when a file in the SSR module graph changes, the mini-oxygen instance is disposed so the next request starts a fresh workerd with a clean module-runner cache. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Remove redundant MiniOxygen watcher and HTML injection cleanup while keeping the SSR environment request-driven. Co-authored-by: Codex <codex@openai.com>
Remove the custom MiniOxygen environment marker/getter and read the entrypoint error handler from plugin state instead. Co-authored-by: Codex <codex@openai.com>
Update MiniOxygen Vite runtime comments to reflect the current request-driven server refresh model and inspector behavior. Co-authored-by: Codex <codex@openai.com>
Document the warmup timing and SSR environment replacement behavior in MiniOxygen's Vite environment integration. Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Contributor
|
We detected some changes in |
Contributor
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
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.
Since Vite 8 uses Rolldown I thought we could migrate the build tool also to it. TSDown is the successor of TSUp 🙃
Build time improves by ~33%