Skip to content

dts-gen doesn't work with cloudflare-video-element: require() of ES Module not supported. #1001

@ADTC

Description

@ADTC

I tried generating for this project cloudflare-video-element but it failed with the following error. (I tried both project install and global install. The error is the same.)

dts-gen -m cloudflare-video-element
Unexpected crash! Please log a bug with the commandline you specified.
/opt/homebrew/lib/node_modules/dts-gen/dist/run.js:84
        result = guess.generateModuleDeclarationFile(args.module, require(args.module));
                                                                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/homebrew/lib/node_modules/cloudflare-video-element/cloudflare-video-element.js from /opt/homebrew/lib/node_modules/dts-gen/dist/run.js not supported.
Instead change the require of cloudflare-video-element.js in /opt/homebrew/lib/node_modules/dts-gen/dist/run.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/opt/homebrew/lib/node_modules/dts-gen/dist/run.js:84:67) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions