From 3e5a22932fc507f44701e2a14d9d42981b319685 Mon Sep 17 00:00:00 2001 From: Naman Goel Date: Thu, 5 Dec 2024 04:06:33 -0800 Subject: [PATCH] fix: Use POSIX paths when inserting import statements correctly this time (#797) --- packages/cli/src/files.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/files.js b/packages/cli/src/files.js index a714ed92..ffd5a9db 100644 --- a/packages/cli/src/files.js +++ b/packages/cli/src/files.js @@ -73,7 +73,11 @@ export function isJSFile(filePath: string): boolean { // e.g. ./pages/home/index.js -> ../../stylex_bundle.css export function getRelativePath(from: string, to: string): string { const relativePath = path.posix.relative(path.parse(from).dir, to); - return formatRelativePath(relativePath); + return formatRelativePath(toPosixPath(relativePath)); +} + +function toPosixPath(filePath: string): string { + return filePath.split(path.sep).join(path.posix.sep); } function formatRelativePath(filePath: string) {