Skip to content

Commit c537b03

Browse files
authored
Fix resolving against the working directory in legacy API (#212)
1 parent 8612f48 commit c537b03

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/src/legacy/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ function adjustOptions<sync extends 'sync' | 'async'>(
8383
throw new Error('Either options.data or options.file must be set.');
8484
}
8585

86+
// In legacy API, the current working directory is always attempted before
87+
// any load path.
88+
options.includePaths = [process.cwd(), ...(options.includePaths ?? [])];
89+
8690
if (
8791
!isStringOptions(options) &&
8892
// The `indentedSyntax` option takes precedence over the file extension in the
@@ -200,9 +204,7 @@ function pluginThis(
200204
context: undefined as unknown as LegacyPluginThis,
201205
file: options.file,
202206
data: options.data,
203-
includePaths: [process.cwd(), ...(options.includePaths ?? [])].join(
204-
p.delimiter
205-
),
207+
includePaths: (options.includePaths ?? []).join(p.delimiter),
206208
precision: 10,
207209
style: 1,
208210
indentType: 0,

0 commit comments

Comments
 (0)