canirequire › Dual (CommonJS + ESM) › echarts
Is echarts ESM-only? Can you require() it?
Apache ECharts is a powerful, interactive charting and data visualization library for browser
Latest version 6.1.0, published May 19, 2026. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
echarts publishes both a CommonJS entry and a native ESM entry (ESM added in 5.5.0). require("echarts") should work on every Node.js version the package supports; the runtime probe has not run for this version. import "echarts" works alongside it.
What to do
- Nothing to change. require("echarts") should work on every Node.js version the package supports; the runtime probe has not run for this version. import * as echarts from "echarts" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does echarts@6.1.0 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.
| Runtime | require("echarts") | import "echarts" |
|---|---|---|
| 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.4.0 | pending | pending |
Install failed in our sandbox: PROBE_TIMEOUT The rows above show what package.json declares.
How to import echarts
ES modules (import)
import * as echarts from "echarts";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const echarts = require("echarts");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 (74 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 5.5.0 – 6.1.0 | Dual (CommonJS + ESM) | Feb 18, 2024 |
| 3.2.1 – 5.4.3 | CommonJS | Jul 4, 2016 |
Frequently asked
Is echarts ESM-only?
echarts@6.1.0 ships CommonJS and ESM builds. echarts publishes both a CommonJS entry and a native ESM entry (ESM added in 5.5.0). require("echarts") should work on every Node.js version the package supports; the runtime probe has not run for this version. import "echarts" works alongside it.
Can I require echarts?
Yes. echarts ships a CommonJS entry alongside the native ESM entry. require("echarts") should work on every Node.js version the package supports; the runtime probe has not run for this version.
Does echarts ship TypeScript types?
Yes. echarts 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
- jasmine-core 7.0.2CommonJS
- react-dnd 16.0.1ESM-only
- nock 14.0.17CommonJS
- @angular/platform-browser 22.1.5ESM-only
- @storybook/blocks 8.6.14Dual
- @angular/forms 22.1.5ESM-only
- eslint-plugin-promise 7.3.0CommonJS
- @angular/router 22.1.5ESM-only