canirequire › Dual (CommonJS + ESM) › vite-plugin-dts
Is vite-plugin-dts ESM-only? Can you require() it?
<h1 align="center">vite-plugin-dts</h1>
Last verified Sep 9, 2026 against vite-plugin-dts@5.1.0. Markdown · JSON
Dual (CommonJS + ESM) Dual package on paper — require() failed in our runtime test
vite-plugin-dts declares both a CommonJS entry and a native ESM entry (ESM added in 1.6.2), but require("vite-plugin-dts") failed on every Node.js version in our probe: [unplugin-dts] The installed "typescript" package does not provide the JavaScript Compiler API (this happens with TypeScript 7+), and the…. That usually means a missing peer dependency, a browser-only global, or a package that refuses to be loaded with require(); see the runtime table below.
What to do
- require("vite-plugin-dts") failed in our probe on every Node.js version ([unplugin-dts] The installed "typescript" package does not provide the JavaScript Compiler API (this happens with TypeScript 7+), and the…); check the package README for peer dependencies or setup before relying on it.
- TypeScript: types are bundled; install nothing extra.
Does vite-plugin-dts@5.1.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("vite-plugin-dts") from a CommonJS file and import "vite-plugin-dts" from an ES module.
| Runtime | require("vite-plugin-dts") | import "vite-plugin-dts" |
|---|---|---|
| Node.js 18 | ✗ failsError | ✗ failsError |
| Node.js 20 | ✗ failsError | ✗ failsError |
| Node.js 22 | ✗ failsError | ✗ failsError |
| Node.js 24 | ✗ failsError | ✗ failsError |
| Node.js 26 | ✗ failsError | ✗ failsError |
| Bun 1.4.0 | ✗ failsError | ✗ failsError |
A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.
How to import vite-plugin-dts
ES modules (import)
import * as vitePluginDts from "vite-plugin-dts";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("vite-plugin-dts") failed in our probe on every Node.js version we test ([unplugin-dts] The installed "typescript" package does not provide the JavaScript Compiler API (this happens with TypeScript 7+), and the…); see the runtime table.
const vitePluginDts = require("vite-plugin-dts");Module format by version
Derived from the type, main and exports fields of every stable release on npm, corrected where a runtime test of that version contradicted them (114 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 1.7.2 – 5.1.0 | Dual (CommonJS + ESM) | Jan 31, 2023 |
Frequently asked
Is vite-plugin-dts ESM-only?
vite-plugin-dts@5.1.0 declares CommonJS and ESM builds, but require() fails at runtime. vite-plugin-dts declares both a CommonJS entry and a native ESM entry (ESM added in 1.6.2), but require("vite-plugin-dts") failed on every Node.js version in our probe: [unplugin-dts] The installed "typescript" package does not provide the JavaScript Compiler API (this happens with TypeScript 7+), and the…. That usually means a missing peer dependency, a browser-only global, or a package that refuses to be loaded with require(); see the runtime table below.
Can I require vite-plugin-dts?
Not in practice. vite-plugin-dts declares a CommonJS entry, but require("vite-plugin-dts") failed on every Node.js version in our probe: [unplugin-dts] The installed "typescript" package does not provide the JavaScript Compiler API (this happens with TypeScript 7+), and the…. Check the package README for peer dependencies or setup before relying on it.
Does vite-plugin-dts work in Bun?
Importing vite-plugin-dts failed in Bun 1.4.0 on Sep 9, 2026: error: [unplugin-dts] The installed "typescript" package does not provide the JavaScript Compiler API (this happens with TypeScript 7+), and the fallback "@typescript/typescript6" was not found.
Does vite-plugin-dts ship TypeScript types?
Yes. vite-plugin-dts bundles its own type declarations; no @types package is needed.
Links
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- tslib 2.8.1Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
Similar popularity
- @angular/platform-browser-dynamic 22.1.5ESM-only
- markdown-it-anchor 10.0.0CommonJS
- popper.js 1.16.1CommonJS
- @babel/cli 8.0.4No entry
- pug 3.0.4CommonJS
- @changesets/cli 3.0.2ESM-only
- webpack-manifest-plugin 6.0.1ESM-only
- rollup-plugin-terser 7.0.2Dual