guide ยท react & vite
Free bug report widget for React & Vite (18 KB, MIT)
Paste BugSnap's single <script> tag into index.html before </body>. Unlike npm modal libraries that leave screenshots and the backend to you, BugSnap is 18 KB (about 8 KB gzipped), masks sensitive inputs, and is $0 free forever.
1. add it to index.html (recommended for Vite + React)
In any Vite, Create React App or React SPA project, open index.html and add the deferred script tag right before </body>:
<script
src="https://getbugsnap.pages.dev/widget.js"
data-project-key="YOUR_PROJECT_KEY"
data-trigger="on-error"
defer
></script>
To keep the key per environment, use Vite's HTML env replacement: put VITE_BUGSNAP_KEY in .env and write data-project-key="%VITE_BUGSNAP_KEY%" in index.html.
2. invisible on-error mode or a floating button
data-trigger="on-error"(recommended): nothing renders until a visitor hits an uncaught error, failed API call, broken image, UI freeze or dead click.data-trigger="floating": shows a small bug button in the corner. Adddata-position="bottom-left"ordata-accent="#175846"to match your app.
3. why BugSnap instead of a DIY React modal package
- No upload backend to maintain: reports land in your BugSnap inbox, GitHub Issues, Slack, Discord or a webhook.
- No monthly-active-user paywall: the free hosted tier covers 5 projects and 100 reports a month, and MIT self-hosting is unlimited.
- Built-in masking: passwords, emails, card fields and Stripe and PayPal iframes are masked before capture, and visitors choose Cropped, Full or No screenshot before sending.
- AI-ready Markdown: copy any report into Cursor, Claude Code or Codex, or try the format with the free bug report to AI prompt generator.
Want the details? Read how BugSnap masks cards, passwords and tokens before a screenshot exists, and how to turn live bug reports into prompts for AI coding agents.