Skip to content

Commit

Permalink
fix: detect mdx files using full extension (#7192)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed May 24, 2023
1 parent 27c6e01 commit 7851f92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/lazy-zebras-invent.md
@@ -0,0 +1,6 @@
---
'@astrojs/mdx': patch
'astro': patch
---

Detect `mdx` files using their full extension
2 changes: 1 addition & 1 deletion packages/astro/src/content/runtime.ts
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/mdx/src/index.ts
Expand Up @@ -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);
Expand Down

0 comments on commit 7851f92

Please sign in to comment.