[ ] Documentation update
[x] Bug fix
[ ] New feature
[ ] Other
alternative to #164
before
$ npm run benchmark
> bencode@4.0.0 benchmark
> nanobench benchmark/*.js
/tmp/node-bencode/node_modules/nanobench/run.js:7
for (let i = 2; i < process.argv.length; i++) require(path.join(process.cwd(), process.argv[i]))
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /tmp/node-bencode/benchmark/bencode.js from /tmp/node-bencode/node_modules/nanobench/run.js not supported.
Instead change the require of bencode.js in /tmp/node-bencode/nanobench/run.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/tmp/node-bencode/node_modules/nanobench/run.js:7:47) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v20.3.1
purpose
[ ] Documentation update [x] Bug fix [ ] New feature [ ] Other
alternative to #164
before
after