microsoft / dts-gen

dts-gen creates starter TypeScript definition files for any module or library.
MIT License
2.43k stars 101 forks source link

"Unexpected crash! Please log a bug" for `dts-gen -m @orbitdb/core` #188

Open MichaelJCole opened 8 months ago

MichaelJCole commented 8 months ago
> $ dts-gen -m @orbitdb/core                                 ⬡ 18.18.0 [±dev ✓]
Unexpected crash! Please log a bug with the commandline you specified.
/home/michael/.nvm/versions/node/v18.18.0/lib/node_modules/dts-gen/bin/lib/run.js:58
        result = guess.generateModuleDeclarationFile(args.module, require(args.module));
                                                                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/michael/causing-us/friend-server/node_modules/@orbitdb/core/src/index.js from /home/michael/.nvm/versions/node/v18.18.0/lib/node_modules/dts-gen/bin/lib/run.js not supported.
Instead change the require of index.js in /home/michael/.nvm/versions/node/v18.18.0/lib/node_modules/dts-gen/bin/lib/run.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/michael/.nvm/versions/node/v18.18.0/lib/node_modules/dts-gen/bin/lib/run.js:58:67) {
  code: 'ERR_REQUIRE_ESM'
}

Can require() be replaced with a dynamic import()?