fix(studio): inject runtime env overrides in embedded mode#1011
Closed
miguel-heygen wants to merge 1 commit into
Closed
fix(studio): inject runtime env overrides in embedded mode#1011miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
VITE_STUDIO_* env vars set in the user's shell had no effect when running `hyperframes preview` because the pre-built studio bundle had them baked at Vite build time. The embedded Hono server now collects VITE_STUDIO_* vars from process.env and injects them as a `window.__HF_STUDIO_ENV__` script tag into index.html. The client merges this runtime object on top of the baked `import.meta.env`, so flags like VITE_STUDIO_ENABLE_BLOCKS_PANEL=1 work as expected at runtime.
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.
Summary
VITE_STUDIO_*env vars (e.g.VITE_STUDIO_ENABLE_BLOCKS_PANEL=1) set in the user's shell were silently ignored when runninghyperframes previewin embedded mode (pre-built SPA). Vite bakesimport.meta.envat build time, so runtime env vars never reached the client.VITE_STUDIO_*vars fromprocess.envand injects them aswindow.__HF_STUDIO_ENV__into the served HTML. The client merges these runtime overrides on top of the bakedimport.meta.env, so runtime values take precedence.Test plan
VITE_STUDIO_ENABLE_BLOCKS_PANEL=1 npx hyperframes previewshows the Blocks tab in embedded modebun run dev) continues to work as before (Vite handles env vars natively)