Skip to content

fix(PreviewBanner): read build-time vars from process.env - #6

Merged
clord merged 1 commit into
mainfrom
fix/preview-banner-process-env
Jul 26, 2026
Merged

clord merged 1 commit into
mainfrom
fix/preview-banner-process-env

Conversation

@clord

@clord clord commented Jul 26, 2026

Copy link
Copy Markdown
Member

Problem

The approval banner never rendered on any preview deploy. The component read import.meta.env.PLIOSOFT_PREVIEW etc., but Vite only exposes .env-file vars and PUBLIC_-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.env in 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-banner markup and the JWT bake into the HTML; with them unset (production), nothing is emitted.

🤖 Generated with Claude Code

….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>
@clord
clord merged commit 3bdabfc into main Jul 26, 2026
1 check passed
@clord
clord deleted the fix/preview-banner-process-env branch July 26, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant