summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/blue-spiders-carry.md5
-rw-r--r--packages/astro/src/content/mutable-data-store.ts2
-rw-r--r--packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back!.mdx16
-rw-r--r--packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back.jpgbin0 -> 57598 bytes
4 files changed, 22 insertions, 1 deletions
diff --git a/.changeset/blue-spiders-carry.md b/.changeset/blue-spiders-carry.md
new file mode 100644
index 000000000..a9819f5db
--- /dev/null
+++ b/.changeset/blue-spiders-carry.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes a bug where MDX files with certain characters in the name would cause builds to fail
diff --git a/packages/astro/src/content/mutable-data-store.ts b/packages/astro/src/content/mutable-data-store.ts
index 9587b3059..fdffec7cb 100644
--- a/packages/astro/src/content/mutable-data-store.ts
+++ b/packages/astro/src/content/mutable-data-store.ts
@@ -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')}]);
diff --git a/packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back!.mdx b/packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back!.mdx
new file mode 100644
index 000000000..a4442fb6f
--- /dev/null
+++ b/packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back!.mdx
@@ -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)
diff --git a/packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back.jpg b/packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back.jpg
new file mode 100644
index 000000000..7455a726e
--- /dev/null
+++ b/packages/astro/test/fixtures/content-layer-rendering/content-outside-src-mdx/I'm back.jpg
Binary files differ