aboutsummaryrefslogtreecommitdiff
path: root/packages/astro/src/jsx/rehype.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro/src/jsx/rehype.ts')
-rw-r--r--packages/astro/src/jsx/rehype.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/astro/src/jsx/rehype.ts b/packages/astro/src/jsx/rehype.ts
index 6dcb08d0b..a93a92d5d 100644
--- a/packages/astro/src/jsx/rehype.ts
+++ b/packages/astro/src/jsx/rehype.ts
@@ -132,8 +132,15 @@ function parseImports(children: RootContent[]) {
return { local: spec.local.name, imported: 'default' };
case 'ImportNamespaceSpecifier':
return { local: spec.local.name, imported: '*' };
- case 'ImportSpecifier':
- return { local: spec.local.name, imported: spec.imported.name };
+ case 'ImportSpecifier': {
+ return {
+ local: spec.local.name,
+ imported:
+ spec.imported.type === 'Identifier'
+ ? spec.imported.name
+ : String(spec.imported.value),
+ };
+ }
default:
throw new Error('Unknown import declaration specifier: ' + spec);
}