Skip to content

Commit

Permalink
fix(create-module-loader): handle case where findProject root returns…
Browse files Browse the repository at this point in the history
… undefined (#151)
  • Loading branch information
mediremi authored Jan 6, 2022
1 parent 22f49b7 commit d27204d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/createModuleLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ module.exports = ({ parentModule, preferLocal = true }) => {

// create a require fn bound to the cwd project's node_modules
const root = findProjectRoot({ markers: ['package.json'] })
const rootRequire = createRequire(path.resolve(root, 'package.json'))
const rootRequire = createRequire(
root ? path.resolve(root, 'package.json') : '/'
)

if (!preferLocal) {
reporter.warn('Project-local module resolution for tools is disabled.')
Expand Down

0 comments on commit d27204d

Please sign in to comment.