Skip to content

feat: configurable widget URL for Vercel preview deployments#34

Merged
neonwatty merged 1 commit intomainfrom
feat/vercel-preview-setup
Apr 4, 2026
Merged

feat: configurable widget URL for Vercel preview deployments#34
neonwatty merged 1 commit intomainfrom
feat/vercel-preview-setup

Conversation

@neonwatty
Copy link
Copy Markdown
Collaborator

Summary

  • Add transformIndexHtml Vite plugin to replace __BUGDROP_URL__ placeholder at build time
  • Replace hardcoded production widget URL in index.html with the placeholder
  • Defaults to https://bugdrop.neonwatty.workers.dev when VITE_BUGDROP_URL is 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_URL per environment in Vercel project settings.

After merging — Vercel setup steps

  1. Import this repo into Vercel (vercel.com/new) — auto-detects Vite

  2. Set environment variables in Vercel project settings:

    Variable Production Preview
    VITE_BUGDROP_URL https://bugdrop.neonwatty.workers.dev https://bugdrop-preview.<account>.workers.dev
  3. Deploy a preview branch once to get a stable Vercel preview URL

  4. Note the stable URL and update <STABLE_VERCEL_PREVIEW_URL> in bugdrop's live-tests.yml

  5. Decide whether to remove base: '/feedback-widget-test/' from vite.config.ts (only needed for GitHub Pages subpath — Vercel serves from root)

Test plan

  • npm run build succeeds — default URL substituted
  • VITE_BUGDROP_URL=https://bugdrop-preview.neonwatty.workers.dev npm run build — preview URL substituted
  • Existing GitHub Pages deployment unaffected (default fallback = production URL)

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.
@neonwatty neonwatty merged commit c346f8c into main Apr 4, 2026
3 checks passed
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