fix: detect mdx
files using full extension (#7192)
This commit is contained in:
parent
27c6e01826
commit
7851f9258f
3 changed files with 8 additions and 2 deletions
6
.changeset/lazy-zebras-invent.md
Normal file
6
.changeset/lazy-zebras-invent.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@astrojs/mdx': patch
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Detect `mdx` files using their full extension
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue