Skip to content

Error [ERR_REQUIRE_ESM]: require() of ES Module #916

Open
@alisonailea

Description

@alisonailea

when trying to build custom commitizen prompt configs in node >14 where

{
  "type": "module",
 }

it throws an error

require() of ES Module /custom-cz.js from /node_modules/commitizen/dist/commitizen/adapter.js not supported.
Instead change the require of index.js in /node_modules/commitizen/dist/commitizen/adapter.js to a dynamic import() which is available in all CommonJS modules.
import { configLoader } from 'commitizen';
const config = configLoader.load();

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