Skip to content

Commit

Permalink
fix: detect mdx files using full extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed May 24, 2023
1 parent 2bda7fb commit 9d8e946
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,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 9d8e946

Please sign in to comment.