Skip to content

Commit 6855009

Browse files
committed
fix(build): use path.relative for cross-platform Windows compatibility
1 parent a7baba5 commit 6855009

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

scripts/build.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bun
22
import { mkdirSync, rmSync, cpSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
3-
import { join, dirname, resolve } from 'node:path';
3+
import { join, dirname, resolve, relative } from 'node:path';
44
import { fileURLToPath } from 'node:url';
55
import { platform, arch } from 'node:os';
66
import { $ } from 'bun';
@@ -75,9 +75,10 @@ const resourceFiles = [
7575
];
7676

7777
// Generate simple imports file (no exports/mapping needed with --asset-naming)
78+
const manifestDir = join(repoRoot, 'src', 'shared', 'runtime');
7879
const imports = resourceFiles.map((abs) => {
79-
// Manifest is at src/shared/runtime/, so need ../../../ to reach repo root
80-
const rel = '../../../' + abs.replace(repoRoot + '/', '');
80+
// Use path.relative for cross-platform compatibility, then normalize to forward slashes
81+
const rel = relative(manifestDir, abs).replace(/\\/g, '/');
8182
return `import "${rel}" with { type: "file" };`;
8283
});
8384

0 commit comments

Comments
 (0)