Skip to content

Commit 40cf454

Browse files
committed
fix(bundle): preserve root output path
1 parent 3305dfa commit 40cf454

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/lib/bundle.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,10 @@ describe('resolveBundleDir', () => {
601601
const out = resolveBundleDir('/tmp/x/');
602602
expect(out).toBe('/tmp/x');
603603
});
604+
605+
it('preserves the filesystem root path', () => {
606+
expect(resolveBundleDir('/')).toBe('/');
607+
});
604608
});
605609

606610
describe('streamUrlToFile retry', () => {

src/lib/bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export function resolveBundleDir(rawPath: string): string {
325325
},
326326
});
327327
}
328-
const trimmed = rawPath.endsWith('/') ? rawPath.slice(0, -1) : rawPath;
328+
const trimmed = rawPath.endsWith('/') && rawPath.length > 1 ? rawPath.slice(0, -1) : rawPath;
329329
return isAbsolute(trimmed) ? trimmed : resolve(process.cwd(), trimmed);
330330
}
331331

0 commit comments

Comments
 (0)