Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#1,001 1 comment 3 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
node.js, typescript
Domain
cli, tooling

Research direction

Reproduce the failure with dts-gen -m cloudflare-video-element on Node.js 20.5.1, then inspect dist/run.js around line 84 where the module is loaded with require(). Determine how declaration generation should handle this ES module and verify that the command completes successfully for the reported package.

Written by the indexing model from the issue text.

Description

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
Dominant language
TypeScript
Stars
422
Forks
237
Avg merge
1d 4h
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DefinitelyTyped-tools

All issues in microsoft/DefinitelyTyped-tools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.