canirequire

canirequireDual (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.

Latest
5.1.0 (Sep 1, 2026)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
5.1.0
Native ESM since
1.6.2
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
3.5M
License
MIT

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.

Runtimerequire("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).

VersionsFormatFirst published
1.7.2 – 5.1.0Dual (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

Similar popularity