Use normalized path to detect layout files (#1822)
Co-authored-by: Bence Molnár <bencemol@users.noreply.github.com>
This commit is contained in:
parent
3b8f201c4b
commit
4e55be9006
2 changed files with 6 additions and 1 deletions
5
.changeset/strong-bugs-confess.md
Normal file
5
.changeset/strong-bugs-confess.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes layout file detection on non-unix environments
|
|
@ -48,7 +48,7 @@ export default function astro({ config, devServer }: AstroPluginOptions): vite.P
|
|||
// pages and layouts should be transformed as full documents (implicit <head> <body> 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue