Skip to content

Commit c59245f

Browse files
authored
fix: Add "file://" scheme on windows (#13)
1 parent 7e0190f commit c59245f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bin/bundle.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ if (!mapFilePath || !distDirPath) {
4141
}
4242

4343
const distDir = path.resolve(process.cwd(), distDirPath)
44-
const mapFile = await import(path.resolve(process.cwd(), mapFilePath))
44+
let mapFilePathAbs = path.resolve(process.cwd(), mapFilePath)
45+
if (process.platform === 'win32') mapFilePathAbs = 'file://' + mapFilePathAbs // On Windows, absolute paths must be valid file:// URLs
46+
const mapFile = await import(mapFilePathAbs)
4547

4648
// Determine the blueprints that are being built
4749
let sources = mapFile.BlueprintEntrypoints

bin/extract-translations.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ if (!mapFilePath) {
2727
process.exit(1)
2828
}
2929

30-
const absolutePath = path.resolve(process.cwd(), mapFilePath)
31-
const mapFile = await import(absolutePath)
30+
let mapFilePathAbs = path.resolve(process.cwd(), mapFilePath)
31+
if (process.platform === 'win32') mapFilePathAbs = 'file://' + mapFilePathAbs // On Windows, absolute paths must be valid file:// URLs
32+
const mapFile = await import(mapFilePathAbs)
3233
if (!mapFile) {
3334
console.error(`Failed to load map file: ${absolutePath}`)
3435
process.exit(1)

0 commit comments

Comments
 (0)