diff --git a/.changeset/strong-bugs-confess.md b/.changeset/strong-bugs-confess.md new file mode 100644 index 000000000..4436d3f2c --- /dev/null +++ b/.changeset/strong-bugs-confess.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes layout file detection on non-unix environments diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 891c88996..ea321f65b 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -48,7 +48,7 @@ export default function astro({ config, devServer }: AstroPluginOptions): vite.P // pages and layouts should be transformed as full documents (implicit etc) // everything else is treated as a fragment const normalizedID = fileURLToPath(new URL(`file://${id}`)); - const isPage = normalizedID.startsWith(fileURLToPath(config.pages)) || id.startsWith(fileURLToPath(config.layouts)); + const isPage = normalizedID.startsWith(fileURLToPath(config.pages)) || normalizedID.startsWith(fileURLToPath(config.layouts)); let source = await fs.promises.readFile(id, 'utf8'); let tsResult: TransformResult | undefined;