npm / copy-to-clipboard
copy-to-clipboard
What changed in copy-to-clipboard 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
4 breaking4 new APIs and options2 behavior and defaults1 tooling3 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initcopy-to-clipboard 412 changes
Breaking changes 4
copy() is now async and returns Promise<boolean>; call sites must use await or .then(...).
The window.prompt() fallback is off by default; pass options.fallbackToPrompt: true to enable it.
IE11 support and its window.clipboardData and IE-specific code paths have been removed.
Build output moved to dist/, so direct require('copy-to-clipboard/index.js') imports break; use the package name instead.
New APIs and options 4
The package now provides dual ESM/CJS output with a proper exports field and sideEffects: false.
TypeScript declarations are provided for ESM consumers, alongside index.d.ts for CJS consumers.
Set a custom MIME type to copy formatted content; text/plain is always included alongside it.
The callback receives a ClipboardItem on the async path or a DataTransfer on the execCommand fallback path; it can return a replacement to override.
Behavior and default changes 2
Rich text and HTML copying uses navigator.clipboard.write() with ClipboardItem when options.format or options.onCopy is set.
In secure contexts, navigator.clipboard.writeText() is now the default copy path.
Fixes and other changes 2
Fixed execCommand so it works in fullscreen.
Fixes copying in a modal when the execCommand fallback is used.
copy-to-clipboard 32 changes
Tooling 1
The guide now recommends Python's built-in venv for creating virtual environments instead of virtualenvwrapper.
Fixes and other changes 1
Ubuntu users must install python3-venv before using venv.