Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: detect mdx files using full extension #7192

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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