Skip to content

Commit 7851f92

Browse files
authored
fix: detect mdx files using full extension (#7192)
1 parent 27c6e01 commit 7851f92

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/lazy-zebras-invent.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@astrojs/mdx': patch
3+
'astro': patch
4+
---
5+
6+
Detect `mdx` files using their full extension

packages/astro/src/content/runtime.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ async function render({
306306

307307
let props = baseProps;
308308
// Auto-apply MDX components export
309-
if (id.endsWith('mdx')) {
309+
if (id.endsWith('.mdx')) {
310310
props = {
311311
components: mod.components ?? {},
312312
...baseProps,

packages/integrations/mdx/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
9494
// Override transform to alter code before MDX compilation
9595
// ex. inject layouts
9696
async transform(_, id) {
97-
if (!id.endsWith('mdx')) return;
97+
if (!id.endsWith('.mdx')) return;
9898

9999
// Read code from file manually to prevent Vite from parsing `import.meta.env` expressions
100100
const { fileId } = getFileInfo(id, config);

0 commit comments

Comments
 (0)