diff --git a/bin/cmd.js b/bin/cmd.js index 47be647..fb1ef52 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -20,7 +20,7 @@ import Yargs from 'yargs' import { hideBin } from 'yargs/helpers' import open from 'open' -const { version: webTorrentCliVersion } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url))) +import webTorrentCliVersion from '../version.cjs' const webTorrentVersion = WebTorrent.VERSION const yargs = Yargs() diff --git a/version.cjs b/version.cjs new file mode 100644 index 0000000..738f2a4 --- /dev/null +++ b/version.cjs @@ -0,0 +1,2 @@ +// Exports package.json version to work around "with" and "assert" imports for backwards compatability. +module.exports = require('./package.json').version