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. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
vite-plugin-dts publishes both a CommonJS entry and a native ESM entry (ESM added in 1.6.2). require("vite-plugin-dts") and import "vite-plugin-dts" both work on every supported Node.js version and in Bun.
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: [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. | ✗ failsError: [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. |
| Node.js 20 | ✗ failsError: [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. | ✗ failsError: [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. |
| Node.js 22 | ✗ failsError: [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. | ✗ failsError: [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. |
| Node.js 24 | ✗ failsError: [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. | ✗ failsError: [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. |
| Node.js 26 | ✗ failsError: [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. | ✗ failsError: [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. |
| Bun 1.4 | ✗ failserror: [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. | ✗ failserror: [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. |
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 vitePluginDts from "vite-plugin-dts";CommonJS (require)
const vitePluginDts = require("vite-plugin-dts");Module format by version
Derived from the type, main and exports fields of every stable release on npm (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 ships CommonJS and ESM builds. vite-plugin-dts publishes both a CommonJS entry and a native ESM entry (ESM added in 1.6.2). require("vite-plugin-dts") and import "vite-plugin-dts" both work on every supported Node.js version and in Bun.
Can I require vite-plugin-dts?
Yes. vite-plugin-dts ships a CommonJS entry, so require("vite-plugin-dts") works on every Node.js version, alongside the native ESM entry for import.
Does vite-plugin-dts work in Bun?
Importing vite-plugin-dts failed in Bun 1.4 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
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
Similar popularity
- c8 12.0.0CommonJS
- eslint-plugin-flowtype 8.0.3CommonJS
- markdown-it-anchor 10.0.0CommonJS
- popper.js 1.16.1CommonJS
- pug 3.0.4CommonJS
- webpack-manifest-plugin 6.0.1ESM-only
- rollup-plugin-terser 7.0.2Dual
- ethers 6.17.0Dual