diff --git a/.changeset/chilled-coins-wash.md b/.changeset/chilled-coins-wash.md new file mode 100644 index 000000000..df26f52d1 --- /dev/null +++ b/.changeset/chilled-coins-wash.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes aliases on windows. diff --git a/packages/astro/src/vite-plugin-config-alias/index.ts b/packages/astro/src/vite-plugin-config-alias/index.ts index 7ed003b1b..b1e421187 100644 --- a/packages/astro/src/vite-plugin-config-alias/index.ts +++ b/packages/astro/src/vite-plugin-config-alias/index.ts @@ -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[] = [];