Skip to content

Commit

Permalink
Fix alias path on Windows to be '@/*' or '@src/*' instead of '@\\*' or '
Browse files Browse the repository at this point in the history
@src\\*' (#69)

* Fix alias path on Windows, since unlike replacement which is a valid directory path, on Windows using path, the alias string gets escaped to '@\\*' or '@src\\*' instead of '@/*' or '@src/*'

* changeset

---------

Co-authored-by: Mihai1iMob <mihai@utilmond.com>
Co-authored-by: Horus Lugo <horusgoul@gmail.com>
  • Loading branch information
3 people authored Apr 14, 2024
1 parent 5f9bd3e commit 9a969ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fresh-beers-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vite-plugin-stylex": patch
---

Fix alias path on Windows to be '@/_' or '@src/_' instead of '@\\_' or '@src\\_'. Thanks to @DarkAng3L for the PR!
2 changes: 1 addition & 1 deletion packages/vite-plugin-stylex/src/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default function styleXVitePlugin({
if (typeof viteAlias.find === "string") {
// We need to convert Vite format to this plugin's format:
// Example: @ -> @/*
const alias = path.join(viteAlias.find, "*");
const alias = viteAlias.find.concat("/*");
aliases[alias] = [path.join(viteAlias.replacement, "*")];
}
}
Expand Down

0 comments on commit 9a969ac

Please sign in to comment.