Skip to content

Commit b2db7d6

Browse files
author
Felix Lechenbauer
committed
fix: import package.json in an ES module compatible way
1 parent b4557a7 commit b2db7d6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

bin/cmd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import minimist from 'minimist'
44
import { Server } from '../index.js'
5+
import { createRequire } from 'module'
56

67
const argv = minimist(process.argv.slice(2), {
78
alias: {
@@ -34,6 +35,7 @@ const argv = minimist(process.argv.slice(2), {
3435
})
3536

3637
if (argv.version) {
38+
const require = createRequire(import.meta.url)
3739
console.log(require('../package.json').version)
3840
process.exit(0)
3941
}

0 commit comments

Comments
 (0)