canirequire

canirequireCommonJS › ant-design-vue

Is ant-design-vue ESM-only? Can you require() it?

An enterprise-class UI design language and Vue-based implementation

Latest version 4.2.6, published Nov 11, 2024. JSON

CommonJS CommonJS — require() works on every Node.js version

ant-design-vue ships CommonJS only. require("ant-design-vue") works everywhere. import "ant-design-vue" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

It also declares a "module" field, so bundlers such as webpack, Vite and esbuild pick up an ESM build for tree-shaking.

Latest
4.2.6 (Nov 11, 2024)
Module format
CommonJS
Last CommonJS version
4.2.6
TypeScript types
Bundled
Node engines
>=12.22.0
Weekly downloads
168K
License
MIT

Does ant-design-vue@4.2.6 actually load? Runtime test results

Runtime probe pending for this version. The values below are what package.json declares; they are refreshed once the probe runs.

Runtimerequire("ant-design-vue")import "ant-design-vue"
Node.js 18✓ expected✓ expected
Node.js 20✓ expected✓ expected
Node.js 22✓ expected✓ expected
Node.js 24✓ expected✓ expected
Node.js 26✓ expected✓ expected
Bun 1.4pendingpending

Install failed in our sandbox: PROBE_TIMEOUT The rows above show what package.json declares.

How to import ant-design-vue

ES modules (import)

import antDesignVue from "ant-design-vue";

Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.

CommonJS (require)

const antDesignVue = require("ant-design-vue");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (131 versions; the newest 60 shown).

VersionsFormatFirst published
2.0.0 – 4.2.6CommonJSFeb 6, 2021

Frequently asked

Is ant-design-vue ESM-only?

ant-design-vue@4.2.6 is a CommonJS package. ant-design-vue ships CommonJS only. require("ant-design-vue") works everywhere. import "ant-design-vue" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Can I import ant-design-vue with ES module syntax?

Yes. import antDesignVue from "ant-design-vue" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

Does ant-design-vue ship TypeScript types?

Yes. ant-design-vue bundles its own type declarations; no @types package is needed.

Links

Other commonjs packages

Similar popularity