Registry / web-framework / vite-plugin-url-copy

vite-plugin-url-copy

JSON →
library1.1.4jsnpmunverified

Vite plugin (v1.1.4) that automatically copies the dev/preview server URL to clipboard and optionally generates a QR code for network access. Stable, actively maintained with monthly releases. Supports custom copy content, QR colors, and hot reload. Differentiator: combines URL copy and QR code generation in one plugin, with no extra dependencies. Requires Vite >=4.0.0.

npm install vite-plugin-url-copy
INSTALL
IMPORT
SIG · VITE-PLUGIN-URL-CO
V
vite-plugin-url-copy
web-frameworkjavascriptv1.1.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ServerUrlCopy
import ServerUrlCopy from 'vite-plugin-url-copy'
const ServerUrlCopy = require('vite-plugin-url-copy')
Default ESM export. CJS require works in v1 but is deprecated and will be removed in v2.
vite-plugin-url-copy
import ServerUrlCopy from 'vite-plugin-url-copy'
The package does not export named members. Always use default import.
type ServerUrlCopyOptions
import type { ServerUrlCopyOptions } from 'vite-plugin-url-copy'
Types are exported for configuration. Use import type for compile-time only.

Configure vite-plugin-url-copy in vite.config.ts with network URL copy and QR code enabled.

// vite.config.ts import { defineConfig } from 'vite' import ServerUrlCopy from 'vite-plugin-url-copy' export default defineConfig({ plugins: [ ServerUrlCopy({ copy: { mode: 'network' }, qrcode: { disabled: false, color: 'blue' }, debug: true, }) ], server: { host: true }, }) // Then run: pnpm dev // The terminal will show the local & network URLs, copy the network URL, and display a QR code.
Debug
Known issues
breakingv1.1.0 introduced a new config API structure. Old config object will fail silently or produce unexpected behavior.
fix
Update config to match v1.1.0+ format: { copy: { ... }, qrcode: { ... }, disabled, debug }
affects: <1.1.0
deprecatedCJS build of the plugin is deprecated and will be removed in v2. Use ESM.
fix
Set 'type': 'module' in package.json and use import syntax.
affects: >=1.0.0 <2.0.0
gotchaQR code is disabled by default. You must explicitly set qrcode.disabled = false to enable it.
fix
Add 'qrcode: { disabled: false }' to the plugin config.
affects: >=1.1.0
gotchaTo access the network URL, the Vite server must have host set to true (or --host flag). Otherwise only localhost is shown.
fix
Add 'server: { host: true }' and/or 'preview: { host: true }' in Vite config.
affects: >=1.0.0
Errors
Common errors & fixes
ServerUrlCopy is not a function
Using CommonJS require() with ESM-only import attempt or misconfigured module system.
fix
Ensure package.json has 'type': 'module' and use 'import ServerUrlCopy from 'vite-plugin-url-copy'.
Cannot find module 'vite-plugin-url-copy' or its corresponding type declarations
Forgetting to install the package or incorrect import path (e.g., missing default export).
fix
Run 'npm i -D vite-plugin-url-copy' and use 'import ServerUrlCopy from 'vite-plugin-url-copy'.
TypeError: Cannot destructure property 'copy' of '...' as it is undefined
Using old config format (<1.1.0) where options were flat. New version expects nested objects.
fix
Update config to: ServerUrlCopy({ copy: { mode: 'local' }, qrcode: { disabled: true } })
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies
viterequiredPeer dependency. The plugin hooks into Vite's dev and preview servers; minimal supported version is 4.0.0.
Agent activity
10 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
vite-plugin-url-copy — npm install vite-plugin-url-copy · libregistry