Skip to content

Commit

Permalink
fix: Use POSIX paths when inserting import statements correctly this …
Browse files Browse the repository at this point in the history
…time (#797)
  • Loading branch information
nmn authored Dec 5, 2024
1 parent 52e4846 commit 3e5a229
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/cli/src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3e5a229

Please sign in to comment.