Skip to content

Commit

Permalink
fix(cli): check require stack when encountered with MODULE_NOT_FOUND
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Apr 18, 2020
1 parent 542eb5f commit 7d77728
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/koishi-cli/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { capitalize } from 'koishi-utils'
import { performance } from 'perf_hooks'
import { cyan, yellow } from 'kleur'
import { logger } from './utils'
import { format, types } from 'util'
import { format } from 'util'
import { readFileSync } from 'fs'
import { safeLoad } from 'js-yaml'

Expand Down Expand Up @@ -72,7 +72,7 @@ function loadEcosystem (type: string, name: string) {
try {
return require(name)
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND') {
if (error.code !== 'MODULE_NOT_FOUND' || error.requireStack[0] !== __filename) {
throw error
}
}
Expand Down

0 comments on commit 7d77728

Please sign in to comment.