Skip to content

Types are not compatible with moduleResolution: "NodeNext" #2031

Closed

Description

@Starmarshal

rollup-plugin-license@3.7.1 doesn't work with moduleResolution: "NodeNext".

With the usual import:

import rollupPluginLicense from 'rollup-plugin-license';

TypeScript resolves the CommonJS module as an object instead of a function, so calling the
plugin fails and the build breaks. The function can be reached with a manual .default
access, but that's not a safe workaround: depending on how the module is loaded, .default
is undefined at runtime (see
FalseExportDefault).

The reason is a mismatch between the types and the runtime:

  • the package is CommonJS: "main": "dist/index.js", no exports field, no "type": "module";
  • dist/index.js exports the plugin with module.exports = rollupPluginLicense;;
  • dist/index.d.ts declares:
declare function rollupPluginLicense(options: Options): Plugin;

export default rollupPluginLicense;

For a CommonJS module, export default in the .d.ts describes module.exports.default,
which doesn't exist at runtime.
arethetypeswrong
confirms this - it reports "Incorrect default export" for all resolution kinds
(node10, node16 from CJS, node16 from ESM, bundler).

The types should use export = instead:

declare function rollupPluginLicense(options: Options): Plugin;

export = rollupPluginLicense;

One caveat: export = can't be combined with other export statements, so the exported
types (Options, Person, Dependency, ThirdParty, etc.) would need to be moved into
a declare namespace rollupPluginLicense block.

Would it be possible to fix this?

Activity

  1. locked and limited conversation to collaborators on Oct 20, 2026
  2. converted this issue into a discussion #2032 on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions