Skip to content

Commit 1cf8ae6

Browse files
committed
fix(core): normalize variant paths to posix
1 parent 29692ea commit 1cf8ae6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/core/src/path.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from 'node:path'
1+
import path from 'node:path/posix'
22
import type { ImageFormat } from './formats.ts'
33

44
/**
@@ -9,10 +9,11 @@ import type { ImageFormat } from './formats.ts'
99
* @returns Image variant file path.
1010
*/
1111
export function renameImagePath(imagePath: string, postfix: string, format: ImageFormat) {
12+
// Posix separators, so variant paths are stable across platforms.
1213
const {
1314
dir,
1415
name
15-
} = path.parse(imagePath)
16+
} = path.parse(imagePath.replaceAll('\\', '/'))
1617

1718
return path.format({
1819
dir,

0 commit comments

Comments
 (0)