fix(PreviewBanner): read build-time vars from process.env - #6
Merged
Merged
Conversation
….meta.env Vite only exposes .env-file vars and PUBLIC_-prefixed shell vars on import.meta.env, so the PLIOSOFT_PREVIEW_* variables the sites-app build pipeline passes through the environment were always undefined and the banner silently rendered nothing on every preview deploy. Frontmatter executes in Node at build time (static output), so process.env sees them. Verified against a real customer site build: banner + JWT now bake into preview HTML; production builds (vars unset) still emit nothing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
The approval banner never rendered on any preview deploy. The component read
import.meta.env.PLIOSOFT_PREVIEWetc., but Vite only exposes.env-file vars andPUBLIC_-prefixed vars there — the sites-app pipeline passes these through the shell environment, so they were always undefined and the banner silently no-opped.Fix
Read
process.envin frontmatter instead (runs in Node at build time; static output). Bump to 0.2.3.Verified against a real customer-site build: with the pipeline's env vars set,
pl-preview-bannermarkup and the JWT bake into the HTML; with them unset (production), nothing is emitted.🤖 Generated with Claude Code