Skip to content

Commit

Permalink
fix(util): use resolve package typescript package in yarn workspaces (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andreialecu authored Feb 8, 2020
1 parent 17def6b commit a63808c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/util/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,19 @@ function requireWrapper(moduleName: string): RequireResult {
}
const result: RequireResult = { exists, path, given: moduleName }
try {
result.exports = requireModule(moduleName)
result.exports = requireModule(path)
} catch (error) {
result.error = error
try {
result.exports = requireModule(moduleName)
} catch (error) {
result.error = error
}
}
return result
}

let requireModule = (mod: string) => require(mod)
let resolveModule = (mod: string) => require.resolve(mod)
let resolveModule = (mod: string) => require.resolve(mod, { paths: [process.cwd(), __dirname] })

/**
* @internal
Expand Down

0 comments on commit a63808c

Please sign in to comment.