One plugin
Drop `viteQRCode()` into `vite.config.*`.
Print LAN URLs and scannable terminal QR codes for local Vite development so phones and tablets on the same network can open your app instantly.
Drop `viteQRCode()` into `vite.config.*`.
Keeps Vite's effective network origin when available.
Scan and open the dev server instantly on mobile.
Feature Set
`vite-qr` is small on purpose. The useful part is not a giant API surface, it is reducing the friction between a running Vite server and a real device on your network.
Prints LAN URLs and QR codes directly where you already run the Vite dev server.
Applies only in dev-server mode, so production builds and previews stay untouched.
Uses `server.resolvedUrls.network` first when Vite exposes canonical network targets.
Keeps startup noise low, with optional repeated output on watcher changes when `once: false`.
Tune `hostFamily`, include/exclude raw hosts, override path, or prefer one interface.
Narrow final URLs before printing or pipe messages through your own logger.
`vite-qr init` injects the plugin, and `vite-qr doctor` checks project setup.
Use `printQRCodes`, `getLocalNetworkUrls`, and `getPreferredNetworkUrl` in your own tooling.
Workflow Friction
Find the LAN address that actually works for the current interface and port.
Move the URL to a phone every time you want to test on a real device.
Repeat the process when HTTPS, host selection, or path details change.
Better Flow
Add one plugin and keep app code untouched.
Print QR codes when the Vite server is listening.
Respect resolved Vite network URLs when they are available.
Tune interface preference and URL filtering only when you need to.
Config Reference
vite-qr is intentionally compact: one plugin entry point, two CLI commands, a small set of runtime options, and utilities you can call directly.
Runs only in development via Vite serve mode.
Prefers resolved Vite network URLs when Vite exposes them.
The default network family is `ipv4`.
Link-local addresses are skipped so printed URLs stay useful.
Injects `viteQRCode()` into the detected Vite config and installs the package if needed.
Checks for a Vite project, supported Vite version, installed package, config file, and plugin usage.
Disable printing without removing the plugin.
Defaults to `true`; set `false` to print again on watcher changes while the server keeps running.
Override the printed pathname, for example `"/preview"`.
Defaults to `options.protocol`, then Vite HTTPS config, then `"http"`.
Run custom logic against the final URLs before they are printed.
Provide custom `log` and optional `warn` methods for output control.
Choose `ipv4`, `ipv6`, or `all`.
Whitelist raw interface addresses before URLs are built.
Blacklist raw interface addresses before URLs are built.
Move one network interface to the top of the discovered URL list.