Skip to content

Commit

Permalink
Fix unbound main-method call
Browse files Browse the repository at this point in the history
  • Loading branch information
Tracer1337 committed Sep 3, 2021
1 parent 5f48136 commit d426e2c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ if (!moduleExists(classPath)) {
}

const classModule = require(classPath)
const main = classModule.main || classModule.default.main
const moduleDefault = classModule.default || classModule
const main = moduleDefault.main

if (!main) {
throw new Error("Missing main method in class " + className)
}

main(program.args.slice(1))
main.call(moduleDefault, program.args.slice(1))

0 comments on commit d426e2c

Please sign in to comment.