Skip to content

Commit 0d1eab5

Browse files
authored
fix: escape content module import paths (#12705)
1 parent 70cbd47 commit 0d1eab5

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

.changeset/blue-spiders-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes a bug where MDX files with certain characters in the name would cause builds to fail

packages/astro/src/content/mutable-data-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export default new Map([${exports.join(', ')}]);
137137
// We then export them all, mapped by the import id, so we can find them again in the build.
138138
const lines: Array<string> = [];
139139
for (const [fileName, specifier] of this.#moduleImports) {
140-
lines.push(`['${fileName}', () => import('${specifier}')]`);
140+
lines.push(`[${JSON.stringify(fileName)}, () => import(${JSON.stringify(specifier)})]`);
141141
}
142142
const code = `
143143
export default new Map([\n${lines.join(',\n')}]);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: I'm back!
3+
description: 'Introduction to Iguana.'
4+
publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)'
5+
tags: [cats, felines]
6+
---
7+
8+
import H2 from "../src/components/H2.astro";
9+
10+
<H2>Iguana</H2>
11+
12+
### Iguana
13+
14+
This is a rendered entry
15+
16+
![file](./I'm%20back.jpg)
56.2 KB
Loading

0 commit comments

Comments
 (0)