{"id":22905,"library":"vite-plugin-url-copy","title":"vite-plugin-url-copy","description":"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.","status":"active","version":"1.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/XioDone/vite-plugin-url-copy","tags":["javascript","vite-plugin","vite plugin","QR Code","QRCode","copy server url","vite-plugin-url-copy","typescript"],"install":[{"cmd":"npm install vite-plugin-url-copy","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-url-copy","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-url-copy","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency. The plugin hooks into Vite's dev and preview servers; minimal supported version is 4.0.0.","package":"vite","optional":false}],"imports":[{"note":"Default ESM export. CJS require works in v1 but is deprecated and will be removed in v2.","wrong":"const ServerUrlCopy = require('vite-plugin-url-copy')","symbol":"ServerUrlCopy","correct":"import ServerUrlCopy from 'vite-plugin-url-copy'"},{"note":"The package does not export named members. Always use default import.","wrong":"","symbol":"vite-plugin-url-copy","correct":"import ServerUrlCopy from 'vite-plugin-url-copy'"},{"note":"Types are exported for configuration. Use import type for compile-time only.","wrong":"","symbol":"type ServerUrlCopyOptions","correct":"import type { ServerUrlCopyOptions } from 'vite-plugin-url-copy'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite'\nimport ServerUrlCopy from 'vite-plugin-url-copy'\n\nexport default defineConfig({\n  plugins: [\n    ServerUrlCopy({\n      copy: { mode: 'network' },\n      qrcode: { disabled: false, color: 'blue' },\n      debug: true,\n    })\n  ],\n  server: { host: true },\n})\n\n// Then run: pnpm dev\n// The terminal will show the local & network URLs, copy the network URL, and display a QR code.","lang":"typescript","description":"Configure vite-plugin-url-copy in vite.config.ts with network URL copy and QR code enabled."},"warnings":[{"fix":"Update config to match v1.1.0+ format: { copy: { ... }, qrcode: { ... }, disabled, debug }","message":"v1.1.0 introduced a new config API structure. Old config object will fail silently or produce unexpected behavior.","severity":"breaking","affected_versions":"<1.1.0"},{"fix":"Set 'type': 'module' in package.json and use import syntax.","message":"CJS build of the plugin is deprecated and will be removed in v2. Use ESM.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Add 'qrcode: { disabled: false }' to the plugin config.","message":"QR code is disabled by default. You must explicitly set qrcode.disabled = false to enable it.","severity":"gotcha","affected_versions":">=1.1.0"},{"fix":"Add 'server: { host: true }' and/or 'preview: { host: true }' in Vite config.","message":"To access the network URL, the Vite server must have host set to true (or --host flag). Otherwise only localhost is shown.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure package.json has 'type': 'module' and use 'import ServerUrlCopy from 'vite-plugin-url-copy'.","cause":"Using CommonJS require() with ESM-only import attempt or misconfigured module system.","error":"ServerUrlCopy is not a function"},{"fix":"Run 'npm i -D vite-plugin-url-copy' and use 'import ServerUrlCopy from 'vite-plugin-url-copy'.","cause":"Forgetting to install the package or incorrect import path (e.g., missing default export).","error":"Cannot find module 'vite-plugin-url-copy' or its corresponding type declarations"},{"fix":"Update config to: ServerUrlCopy({ copy: { mode: 'local' }, qrcode: { disabled: true } })","cause":"Using old config format (<1.1.0) where options were flat. New version expects nested objects.","error":"TypeError: Cannot destructure property 'copy' of '...' as it is undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}