feat: configurable widget URL for Vercel preview deployments#34
Merged
feat: configurable widget URL for Vercel preview deployments#34
Conversation
Replace hardcoded production widget URL in index.html with a __BUGDROP_URL__ placeholder, resolved at build time by a Vite transformIndexHtml plugin. Defaults to production URL when env var is not set. This enables Vercel preview deployments to load the widget from the CF Workers preview (bugdrop-preview) instead of production.
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
transformIndexHtmlVite plugin to replace__BUGDROP_URL__placeholder at build timeindex.htmlwith the placeholderhttps://bugdrop.neonwatty.workers.devwhenVITE_BUGDROP_URLis not set (backwards compatible with current GitHub Pages deployment)This enables Vercel preview deployments to load the widget from the CF Workers preview worker instead of production, by setting
VITE_BUGDROP_URLper environment in Vercel project settings.After merging — Vercel setup steps
Import this repo into Vercel (vercel.com/new) — auto-detects Vite
Set environment variables in Vercel project settings:
VITE_BUGDROP_URLhttps://bugdrop.neonwatty.workers.devhttps://bugdrop-preview.<account>.workers.devDeploy a
previewbranch once to get a stable Vercel preview URLNote the stable URL and update
<STABLE_VERCEL_PREVIEW_URL>in bugdrop'slive-tests.ymlDecide whether to remove
base: '/feedback-widget-test/'fromvite.config.ts(only needed for GitHub Pages subpath — Vercel serves from root)Test plan
npm run buildsucceeds — default URL substitutedVITE_BUGDROP_URL=https://bugdrop-preview.neonwatty.workers.dev npm run build— preview URL substituted