diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index e77389ff6..609d0de10 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -57,7 +57,7 @@ export default function astro({ config, devServer }: AstroPluginOptions): vite.P // use `sourcemap: "both"` so that sourcemap is included in the code // result passed to esbuild, but also available in the catch handler. tsResult = await transform(source, { - as: isPage ? 'document' : 'fragment', + as: 'fragment', projectRoot: config.projectRoot.toString(), site: config.buildOptions.site, sourcefile: id, diff --git a/packages/astro/src/vite-plugin-markdown/index.ts b/packages/astro/src/vite-plugin-markdown/index.ts index 0d868a7cd..e5a41597d 100644 --- a/packages/astro/src/vite-plugin-markdown/index.ts +++ b/packages/astro/src/vite-plugin-markdown/index.ts @@ -53,6 +53,7 @@ ${setup}`.trim(); // Transform from `.astro` to valid `.ts` let { code: tsResult } = await transform(astroResult, { + as: 'fragment', projectRoot: config.projectRoot.toString(), site: config.buildOptions.site, sourcefile: id,