Skip to content

Commit

Permalink
fix: add missing conditions param for moduleResolve
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Mar 7, 2024
1 parent 9b4ac34 commit 3786c25
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion @commitlint/resolve-extends/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const pathSuffixes = [

const specifierSuffixes = ['', '.js', '.json', '/index.js', '/index.json'];

const conditions = new Set(['import', 'node']);

/**
* @see moduleResolve
*/
Expand All @@ -51,7 +53,7 @@ export const resolveFrom = (lookup: string, parent?: string): string => {

for (const suffix of specifierSuffixes) {
try {
return fileURLToPath(moduleResolve(lookup + suffix, base));
return fileURLToPath(moduleResolve(lookup + suffix, base, conditions));
} catch (err) {
if (!resolveError) {
resolveError = err as Error;
Expand Down

0 comments on commit 3786c25

Please sign in to comment.