named-exports-db
raw JSON → 0.1.6 verified Mon Apr 27 auth: no javascript maintenance
A database of packages that require named exports when bundled with Rollup's @rollup/plugin-commonjs. It lists packages that export CommonJS modules where named exports cannot be statically analyzed, necessitating explicit configuration. Version 0.1.6 is the latest and only stable release; the package is largely a reference list with no active development. Differentiator: serves as a community-maintained lookup for Rollup bundling issues, unlike alternatives that are runtime-based or plugin-specific.
Common errors
error Could not determine named exports for module 'some-package' ↓
cause The bundle contains a CommonJS module that cannot be statically analyzed.
fix
Add the package and its exports to the 'namedExports' option in @rollup/plugin-commonjs, using data from named-exports-db.
error Error: Cannot find module 'named-exports-db' ↓
cause Package not installed or not found in node_modules.
fix
Run 'npm install named-exports-db' or 'yarn add named-exports-db'.
Warnings
breaking The database may be incomplete or outdated; always verify with actual bundle analysis. ↓
fix Use tools like https://rollupjs.org/guide/en/#rollupplugin-commonjs to detect missing named exports.
gotcha The package is not a substitute for understanding CommonJS interop; entries may change between versions without notice. ↓
fix Pin version and test after updates.
deprecated No active maintenance; the repository may be archived. Newer Rollup plugins handle some cases better. ↓
fix Consider using @rollup/plugin-commonjs with 'requireReturnsDefault' option or newer bundlers.
Install
npm install named-exports-db yarn add named-exports-db pnpm add named-exports-db Imports
- namedExportsDb wrong
const namedExportsDb = require('named-exports-db')correctimport namedExportsDb from 'named-exports-db' - getNamedExports wrong
const { getNamedExports } = require('named-exports-db')correctimport { getNamedExports } from 'named-exports-db' - db wrong
import db from 'named-exports-db'; const { db } = db;correctimport { db } from 'named-exports-db'
Quickstart
import { getNamedExports, db } from 'named-exports-db';
// Check if a package is in the database
const pkgName = 'some-commonjs-package';
if (db.has(pkgName)) {
const exports = getNamedExports(pkgName);
console.log(`Named exports for ${pkgName}:`, exports);
} else {
console.log(`${pkgName} not found. You may need to manually configure named exports in @rollup/plugin-commonjs.`);
}
// Example for Rollup configuration
// rollup.config.js
// import commonjs from '@rollup/plugin-commonjs';
// export default {
// plugins: [commonjs({ namedExports: { [pkgName]: exports } })]
// };