Skip to content

Commit bf7dd0a

Browse files
committed
refactor: fix jiti context
1 parent 5301aa7 commit bf7dd0a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/utils/src/lib/import-module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export async function importModule<T = unknown>(
1818
): Promise<T> {
1919
const { filepath, tsconfig, ...jitiOptions } = options;
2020

21-
const resolvedStats = await settlePromise(stat(options.filepath));
21+
const resolvedStats = await settlePromise(stat(filepath));
2222
if (resolvedStats.status === 'rejected') {
23-
throw new Error(`File '${options.filepath}' does not exist`);
23+
throw new Error(`File '${filepath}' does not exist`);
2424
}
2525
if (!resolvedStats.value.isFile()) {
26-
throw new Error(`Expected '${options.filepath}' to be a file`);
26+
throw new Error(`Expected '${filepath}' to be a file`);
2727
}
2828

29-
const jitiInstance = await createTsJiti(options.filepath, {
29+
const jitiInstance = await createTsJiti(process.cwd(), {
3030
...jitiOptions,
31-
tsconfigPath: options.tsconfig,
31+
tsconfigPath: tsconfig,
3232
});
3333
return (await jitiInstance.import(filepath, { default: true })) as T;
3434
}

0 commit comments

Comments
 (0)