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.

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'.
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.
npm install named-exports-db
yarn add named-exports-db
pnpm add named-exports-db

Shows how to lookup a package's named exports and integrate with Rollup's commonjs plugin.

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 } })]
// };