Open steveoh opened 10 months ago
It was really difficult to understand the error, because you didn't explain where is the error. And "If i move the import above" isn't very clear: above of what?
So, is it correct that the error is that i
that appears after the import.meta.glob
?
const images = import.meta.glob<{ default: ImageMetadata }>('/src/images/pillar-contact/*.svg');
i // this one
return $$render`wediowqed`;
}, 'Card.astro');
export default $$Card;
It was really difficult to understand the error, because you didn't explain where is the error. And "If i move the import above" isn't very clear: above of what?
I'm sorry. Yes the random i
is the error and invalid syntax.
updating the frontmatter from
---
import type { ImageMetadata } from 'astro';
import Layout from '../layouts/FullWidth.astro';
import Section from '../components/page/Section.astro';
import StaffMember from '../components/page/StaffMember.astro';
import { Image } from 'astro:assets';
const images = import.meta.glob<{ default: ImageMetadata }>('/src/images/pillar-contact/*.svg');
import { staff } from '../data/staff';
---
to
---
import type { ImageMetadata } from 'astro';
import Layout from '../layouts/FullWidth.astro';
import Section from '../components/page/Section.astro';
import StaffMember from '../components/page/StaffMember.astro';
import { Image } from 'astro:assets';
import { staff } from '../data/staff';
const images = import.meta.glob<{ default: ImageMetadata }>('/src/images/pillar-contact/*.svg');
---
which is moving the const images = import.meta.glob<
to the end of the frontmatter removes the invalid compiler generated syntax.
The temporary solution to this is to keep all the static import
statements at the top of the file, and any runtime code (import.meta.glob
) below the import
statements!
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
with the following frontmatter astro throws an error that i is not defined.
astro compiles to
If i move the import above, the error goes away.
What's the expected result?
it should work no matter the order
Link to Minimal Reproducible Example
https://live-astro-compiler.vercel.app/?editor-state=WzMxLDEzOSw4LDAsMTA1LDE4OCwxNjksMTAxLDIsMywxMjUsODIsNzcsNzksMjIwLDQ4LDE2LDI1Myw0Myw4Niw0NiwyMTksODYsMTA4LDIyMCwxNzAsMTgzLDI0NCw2Nyw2Niw4NCw4NCw3MiwzMiw4NSwxMzIsMTUwLDMwLDE4NCwyMDQsMjE4LDE0NywxNzMsMzcsMTI3LDE2NCw1MSwxNCw0Myw4OCwyNDEsMjIzLD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