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
muslnode 18–223 runs
build_error
glibcnode 18–223 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.
Errors
Common errors & fixes
ServerUrlCopy is not a function
Using CommonJS require() with ESM-only import attempt or misconfigured module system.
fixEnsure 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).
fixRun '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.
fixUpdate config to: ServerUrlCopy({ copy: { mode: 'local' }, qrcode: { disabled: true } }) Audit
Dependencies
viterequiredPeer dependency. The plugin hooks into Vite's dev and preview servers; minimal supported version is 4.0.0.