polyfills-db
raw JSON → 3.0.0 verified Sat Apr 25 auth: no javascript
A database of browser polyfill features, version 3.0.0, released as needed. Provides structured metadata about which browsers support each feature and which modules/files implement it. Supports runtime JS polyfills, recast-based JS transpilation, and postcss-based CSS transpilation. Key differentiator: centralized polyfill data for multiple transpilation targets, manually maintained with community contributions. Release cadence: irregular, stable.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/polyfills-db not supported. ↓
cause Using require() with v3 ESM package.
fix
Switch to import: import polyfillsDB from 'polyfills-db'
error TypeError: Cannot read property 'browsers' of undefined ↓
cause Accessing data[feature] where feature key does not exist in the database.
fix
Check the feature exists in the features array before accessing data[feature].browsers.
error SyntaxError: Unexpected token 'export' ↓
cause Node.js version <12 without ESM support, or missing 'type':'module' in package.json.
fix
Update Node.js to >=12 and add 'type':'module' to your package.json.
Warnings
breaking polyfills-db v3 is ESM-only; require() throws ERR_REQUIRE_ESM. ↓
fix Use import syntax or dynamic import().
deprecated The data format changed in v3: previously flat arrays now nested objects. ↓
fix Update to access data[feature].browsers and data[feature].polyfills.
gotcha The 'regenerator' feature includes 'es7-async-fn'; do not use both or runtime duplication occurs. ↓
fix When using regenerator, omit es7-async-fn from polyfill list.
gotcha Manually maintained; browser support data may be outdated for recent browser versions. ↓
fix Cross-check with caniuse.com or MDN for latest data.
deprecated Version 2.x used CJS; v3 drops CJS support entirely. ↓
fix Node.js v12+ supports ESM; add 'type':'module' to package.json.
Install
npm install polyfills-db yarn add polyfills-db pnpm add polyfills-db Imports
- polyfills-db wrong
const polyfillsDB = require('polyfills-db')correctimport polyfillsDB from 'polyfills-db' - data wrong
const { data } = require('polyfills-db')correctimport { data } from 'polyfills-db' - features wrong
import features from 'polyfills-db'correctimport { features } from 'polyfills-db' - browsers
import { browsers } from 'polyfills-db'
Quickstart
import polyfillsDB, { data, features, browsers } from 'polyfills-db';
// Log all feature keys
console.log(features);
// Check browser support for a feature
const feature = 'es6-array-from';
if (data[feature]) {
console.log(`Browsers supporting ${feature}:`, data[feature].browsers);
}
// List available browsers
console.log('Browsers:', browsers);
// The database is a plain object; iterate features
for (const feat of features) {
console.log(feat, data[feat].polyfills);
}