Skip to content

Commit

Permalink
Make aliases work on windows (#2109)
Browse files Browse the repository at this point in the history
* Make aliases work on windows

Change all occurrences of path.posix to path.

* Remove console log statement

* Update index.ts

* Update index.ts

* Update index.ts

* Edit changeset
  • Loading branch information
Mikkel-T committed Dec 3, 2021
1 parent 213a262 commit 3e4cfea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilled-coins-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes aliases on windows.
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-config-alias/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const getConfigAlias = (cwd: string | undefined): Alias[] | null => {
if (!compilerOptions.baseUrl) return null;

// resolve the base url from the configuration file directory
const baseUrl = path.posix.resolve(path.posix.dirname(normalize(config.path)), normalize(compilerOptions.baseUrl));
const baseUrl = path.posix.resolve(path.posix.dirname(normalize(config.path).replace(/^\/?/, '/')), normalize(compilerOptions.baseUrl));

/** List of compiled alias expressions. */
const aliases: Alias[] = [];
Expand Down

0 comments on commit 3e4cfea

Please sign in to comment.