Skip to content

Commit 1ceed99

Browse files
authored
Merge pull request #136 from bluecadet/fix/import-url-scheme
fix importing js configs on windows
2 parents e80381b + 33623e5 commit 1ceed99

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/sixty-goats-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bluecadet/launchpad-utils": patch
3+
---
4+
5+
fix loading js configs on windows

packages/utils/lib/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ export async function loadConfigFromFile(configPath) {
119119
return config;
120120
} else {
121121
// otherwise, parse as js
122-
return (await import(configPath)).default;
122+
123+
// need to use fileURLToPath here for windows support (prefixes with file://)
124+
const fileUrl = url.pathToFileURL(configPath);
125+
return (await import(fileUrl.toString())).default;
123126
}
124127
} catch (err) {
125128
throw new Error(`Unable to load config file '${chalk.white(configPath)}'`, { cause: err });

0 commit comments

Comments
 (0)