Skip to content

Commit

Permalink
fix: config file loading on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AviVahl committed Sep 22, 2022
1 parent 12da273 commit 904d40c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import { pathToFileURL } from 'url';
import { findFileUpSync, isPlainObject, isString } from '@wixc3/resolve-directory-context';

export type SkipConfiguration = string | { name: string; reason?: string };
Expand All @@ -19,7 +20,7 @@ export async function loadPlebConfig(directoryPath: string): Promise<Configurati
for (const configName of possibleConfigNames) {
const configFilePath = findFileUpSync(directoryPath, configName, host);
if (configFilePath !== undefined) {
const { default: configValue } = (await import(configFilePath)) as { default: unknown };
const { default: configValue } = (await import(pathToFileURL(configFilePath).href)) as { default: unknown };
if (!isPlainObject(configValue)) {
throw new Error(`config file ${configFilePath} doesn't export a default object`);
}
Expand Down

0 comments on commit 904d40c

Please sign in to comment.