Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import.meta.env incorrectly rendered in Asides #4110

Closed
liruifengv opened this issue Aug 7, 2023 · 3 comments · Fixed by #5258 or #5256
Closed

import.meta.env incorrectly rendered in Asides #4110

liruifengv opened this issue Aug 7, 2023 · 3 comments · Fixed by #5258 or #5256
Labels
bug Something on the site isn't working help wanted Issues looking for someone to run with them!

Comments

@liruifengv
Copy link
Member

📝 Issue Description

import.meta.env incorrectly rendered in Asides

📋 On which page(s) it occurs

🤔 Expected Behavior

Correctly rendered

👀 Current Behavior

import.meta.env render as import\u002Emeta.env

🖥️ Browser

Chrome

📄 Additional Information

image

@liruifengv liruifengv added the bug Something on the site isn't working label Aug 7, 2023
@100gle
Copy link
Contributor

100gle commented Aug 7, 2023

it seems that this issue is due to the escapeViteEnvReferences() function in #4858 when MDX plugin was set up.

// astro/packages/integrations/mdx/src/index.ts

function escapeViteEnvReferences(code: string) {
	return code.replace(/import\.meta\.env/g, 'import\\u002Emeta.env');
}

@sarah11918
Copy link
Member

Thank you both! We'll let @delucis know about this. (You missed the fun, early days when we literally could NOT render this in Docs at all, and the evolution of all our wild hacks to get this far...)

This led to my favourite Chris PR of all time 😂
importmetaenv

@ElianCodes ElianCodes added the help wanted Issues looking for someone to run with them! label Aug 15, 2023
@TheOtterlord
Copy link
Member

We're in the process of migrating our docs to Starlight. I checked the preview branch for some of the migration work, and it looks like it's rendering fine.

Making a note in case this issue outlives the current docs site. This is not to say we're closed to fixes! It could be some time before this migration is complete, and in the meantime it would be great to find a fix for this and PRs are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something on the site isn't working help wanted Issues looking for someone to run with them!
Projects
None yet
5 participants