Make aliases work on windows (#2109)

* 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
This commit is contained in:
Mikkel Tønder 2021-12-03 16:53:11 +01:00 committed by GitHub
parent 213a2622e2
commit 3e4cfea4e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes aliases on windows.

View file

@ -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[] = [];