summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2023-05-24 10:20:06 +0100
committerGravatar GitHub <noreply@github.com> 2023-05-24 10:20:06 +0100
commit7851f9258fae2f54795470253df9ce4bcd5f9cb0 (patch)
tree625dd414b216eabc14e3ab36c81783bdc693fb9c
parent27c6e01826a6da525f1f811d97784accd1ebbd96 (diff)
downloadastro-7851f9258fae2f54795470253df9ce4bcd5f9cb0.tar.gz
astro-7851f9258fae2f54795470253df9ce4bcd5f9cb0.tar.zst
astro-7851f9258fae2f54795470253df9ce4bcd5f9cb0.zip
fix: detect `mdx` files using full extension (#7192)
-rw-r--r--.changeset/lazy-zebras-invent.md6
-rw-r--r--packages/astro/src/content/runtime.ts2
-rw-r--r--packages/integrations/mdx/src/index.ts2
3 files changed, 8 insertions, 2 deletions
diff --git a/.changeset/lazy-zebras-invent.md b/.changeset/lazy-zebras-invent.md
new file mode 100644
index 000000000..1c2abb981
--- /dev/null
+++ b/.changeset/lazy-zebras-invent.md
@@ -0,0 +1,6 @@
+---
+'@astrojs/mdx': patch
+'astro': patch
+---
+
+Detect `mdx` files using their full extension
diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts
index f38d9192a..9187c4fce 100644
--- a/packages/astro/src/content/runtime.ts
+++ b/packages/astro/src/content/runtime.ts
@@ -306,7 +306,7 @@ async function render({
let props = baseProps;
// Auto-apply MDX components export
- if (id.endsWith('mdx')) {
+ if (id.endsWith('.mdx')) {
props = {
components: mod.components ?? {},
...baseProps,
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts
index 3e1f84c0a..0d1ff9d13 100644
--- a/packages/integrations/mdx/src/index.ts
+++ b/packages/integrations/mdx/src/index.ts
@@ -94,7 +94,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
// Override transform to alter code before MDX compilation
// ex. inject layouts
async transform(_, id) {
- if (!id.endsWith('mdx')) return;
+ if (!id.endsWith('.mdx')) return;
// Read code from file manually to prevent Vite from parsing `import.meta.env` expressions
const { fileId } = getFileInfo(id, config);