diff --git a/packages/@wdio_electron-pkg-builder/src/utils.ts b/packages/@wdio_electron-pkg-builder/src/utils.ts index 802fde4f..231d743a 100644 --- a/packages/@wdio_electron-pkg-builder/src/utils.ts +++ b/packages/@wdio_electron-pkg-builder/src/utils.ts @@ -21,7 +21,7 @@ const findEntryPoint = (name: string, rootDir: string, srcDir: string) => { const checkPath = join(rootDir, srcPath); debug(`Checking path: ${checkPath}`); if (existsSync(checkPath)) { - const posixPath = posix.join(...srcPath.split(sep)); + const posixPath = normalizeToPosix(srcPath); debug(`Found entry point: ${posixPath}`); return posixPath; } @@ -33,6 +33,8 @@ export const getFieldMissingErrorMessage = (field: string, path: string) => { return `"${field}" field which is required is not set: ${path}`; }; +const normalizeToPosix = (path: string) => posix.join(...path.split(sep)); + export const getInputConfig = (pkg: NormalizedReadResult, srcDir: string) => { debug(`Resolving entry points using exports field`); const exportsValue = pkg.packageJson.exports; @@ -44,7 +46,7 @@ export const getInputConfig = (pkg: NormalizedReadResult, srcDir: string) => { const config = Object.keys(exportsValue).reduce((acc: Record, key) => { debug(`Resolving entry points using exports field value: ${key}`); const name = basename(key) === '.' ? 'index' : relative('./', key); - acc[name] = findEntryPoint(name, rootDir, srcDir); + acc[normalizeToPosix(name)] = findEntryPoint(name, rootDir, srcDir); return acc; }, {});