microsoft/DefinitelyTyped-tools

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

ADTC opened this issue · 1 comments

ADTC commented

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

Running dts-gen also doesn't work on https://www.npmjs.com/package/hyphenopoly