diff --git a/.changeset/pink-beans-cross.md b/.changeset/pink-beans-cross.md new file mode 100644 index 000000000000..c56c41b28c0d --- /dev/null +++ b/.changeset/pink-beans-cross.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix slashes for paths containing non-ASCII characters on Windows diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 17fbc41a69d6..07b087493d73 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -126,7 +126,7 @@ export function resolveDependency(dep: string, projectRoot: URL) { * Windows: C:/Users/astro/code/my-project/src/pages/index.astro */ export function viteID(filePath: URL): string { - return slash(fileURLToPath(filePath) + filePath.search); + return slash(fileURLToPath(filePath) + filePath.search).replace(/\\/g, '/'); } export const VALID_ID_PREFIX = `/@id/`; diff --git "a/packages/astro/test/fixtures/non-ascii-path/\346\265\213\350\257\225/package.json" "b/packages/astro/test/fixtures/non-ascii-path/\346\265\213\350\257\225/package.json" new file mode 100644 index 000000000000..0c38763be0da --- /dev/null +++ "b/packages/astro/test/fixtures/non-ascii-path/\346\265\213\350\257\225/package.json" @@ -0,0 +1,8 @@ +{ + "name": "@test/non-ascii-path", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*" + } +} diff --git "a/packages/astro/test/fixtures/non-ascii-path/\346\265\213\350\257\225/src/pages/index.astro" "b/packages/astro/test/fixtures/non-ascii-path/\346\265\213\350\257\225/src/pages/index.astro" new file mode 100644 index 000000000000..57b148ac226b --- /dev/null +++ "b/packages/astro/test/fixtures/non-ascii-path/\346\265\213\350\257\225/src/pages/index.astro" @@ -0,0 +1 @@ +