A Vite plugin (v1.0.12) that automatically creates and manages Cloudflare tunnels for local development, exposing local dev servers to the internet with HTTPS without port forwarding. Offers two modes: Quick Tunnel (zero-config, generates random trycloudflare.com URL) and Named Tunnel (custom domains via Cloudflare API). Requires Vite 4/5/7 and Node >=16. Releases via npm; TypeScript types included. Simpler than manual cloudflared usage or ngrok alternatives.
npm install vite-plugin-cloudflare-tunnelNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Zero-configuration setup: imports the plugin and adds it to Vite's plugin array. Running npm run dev will print a public https://*.trycloudflare.com URL.
Install cloudflared manually via package manager or ensure internet access for automatic download.
Set CLOUDFLARE_API_KEY environment variable. If passing apiToken, use string value, not object.
Use Named Tunnel mode if you need a persistent URL or if corporate firewall blocks trycloudflare.com.
Use Vite 4 or 5; Vite 6 may be incompatible unless the plugin explicitly supports it.
Wait a few seconds after dev server starts before accessing tunnel URL.
Manually install cloudflared (e.g., 'npm install -g cloudflared' or download from Cloudflare), or ensure network access.
Change to 'import cloudflareTunnel from 'vite-plugin-cloudflare-tunnel'' (no curly braces).
Set CLOUDFLARE_API_KEY to a valid Cloudflare API token with proper permissions.
Either call cloudflareTunnel() without arguments for quick mode, or provide hostname and tunnelName for named mode.