canirequire › Dual (CommonJS + ESM) › @vue/test-utils
Is @vue/test-utils ESM-only? Can you require() it?
Last verified Sep 9, 2026 against @vue/test-utils@2.5.0. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
@vue/test-utils publishes both a CommonJS entry and a native ESM entry (ESM added in 1.3.1). require("@vue/test-utils") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@vue/test-utils" works alongside it.
What to do
- Nothing to change. require("@vue/test-utils") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as testUtils from "@vue/test-utils" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does @vue/test-utils@2.5.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@vue/test-utils") from a CommonJS file and import "@vue/test-utils" from an ES module.
| Runtime | require("@vue/test-utils") | import "@vue/test-utils" |
|---|---|---|
| Node.js 18 | ✓ works | ✓ works |
| Node.js 20 | ✓ works | ✓ works |
| Node.js 22 | ✓ works | ✓ works |
| Node.js 24 | ✓ works | ✓ works |
| Node.js 26 | ✓ works | ✓ works |
| Bun 1.4.0 | ✓ works | ✓ works |
How to import @vue/test-utils
ES modules (import)
import * as testUtils from "@vue/test-utils";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const testUtils = require("@vue/test-utils");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 (52 versions; the newest 52 shown).
| Versions | Format | First published |
|---|---|---|
| 1.3.2 – 2.5.0 | Dual (CommonJS + ESM) | Oct 31, 2022 |
| 1.3.1 | ESM-only | Oct 31, 2022 |
| 1.0.0 – 1.3.0 | CommonJS | May 5, 2020 |
Frequently asked
Is @vue/test-utils ESM-only?
@vue/test-utils@2.5.0 ships CommonJS and ESM builds. @vue/test-utils publishes both a CommonJS entry and a native ESM entry (ESM added in 1.3.1). require("@vue/test-utils") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@vue/test-utils" works alongside it.
Can I require @vue/test-utils?
Yes. @vue/test-utils ships a CommonJS entry alongside the native ESM entry. require("@vue/test-utils") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.
Does @vue/test-utils work in Bun?
Yes. import "@vue/test-utils" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @vue/test-utils ship TypeScript types?
Yes. @vue/test-utils 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
- eslint-plugin-vue 10.11.0CommonJS
- typedoc 0.28.20ESM-only
- stylelint-config-standard 40.0.0ESM-only
- typeorm 1.1.1Dual
- @microsoft/api-extractor 7.59.1Dual
- postcss-flexbugs-fixes 5.0.2CommonJS
- @babel/plugin-proposal-json-strings 7.18.6CommonJS
- @storybook/addon-essentials 8.6.14Dual