0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix: escape content module import paths (#12705)

This commit is contained in:
Matt Kane 2024-12-10 10:23:07 +00:00 committed by GitHub
parent 70cbd47694
commit 0d1eab560d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a bug where MDX files with certain characters in the name would cause builds to fail

View file

@ -137,7 +137,7 @@ export default new Map([${exports.join(', ')}]);
// We then export them all, mapped by the import id, so we can find them again in the build.
const lines: Array<string> = [];
for (const [fileName, specifier] of this.#moduleImports) {
lines.push(`['${fileName}', () => import('${specifier}')]`);
lines.push(`[${JSON.stringify(fileName)}, () => import(${JSON.stringify(specifier)})]`);
}
const code = `
export default new Map([\n${lines.join(',\n')}]);

View file

@ -0,0 +1,16 @@
---
title: I'm back!
description: 'Introduction to Iguana.'
publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)'
tags: [cats, felines]
---
import H2 from "../src/components/H2.astro";
<H2>Iguana</H2>
### Iguana
This is a rendered entry
![file](./I'm%20back.jpg)

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB