mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
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;
|
let props = baseProps;
|
||||||
// Auto-apply MDX components export
|
// Auto-apply MDX components export
|
||||||
if (id.endsWith('mdx')) {
|
if (id.endsWith('.mdx')) {
|
||||||
props = {
|
props = {
|
||||||
components: mod.components ?? {},
|
components: mod.components ?? {},
|
||||||
...baseProps,
|
...baseProps,
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
|
||||||
// Override transform to alter code before MDX compilation
|
// Override transform to alter code before MDX compilation
|
||||||
// ex. inject layouts
|
// ex. inject layouts
|
||||||
async transform(_, id) {
|
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
|
// Read code from file manually to prevent Vite from parsing `import.meta.env` expressions
|
||||||
const { fileId } = getFileInfo(id, config);
|
const { fileId } = getFileInfo(id, config);
|
||||||
|
|
Loading…
Add table
Reference in a new issue