Skip to content

Commit

Permalink
fix: handle relative paths more better
Browse files Browse the repository at this point in the history
  • Loading branch information
FUDCo committed Aug 13, 2020
1 parent 2859650 commit e979475
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/SwingSet/src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,13 @@ export function loadBasedir(basedir) {
*/
function resolveSpecFromConfig(dirname, specPath) {
try {
return require.resolve(specPath);
return require.resolve(specPath, { path: [dirname] });
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
return path.resolve(dirname, specPath);
} else {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e;
}
}
return path.resolve(dirname, specPath);
}

/**
Expand Down

0 comments on commit e979475

Please sign in to comment.