canirequire

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

  1. 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.
  2. TypeScript: types are bundled; install nothing extra.
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✗ 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).

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 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

Similar popularity