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

Code blocks in MDX render environmental variables #4801

Closed
1 task
ymcheung opened this issue Sep 19, 2022 · 1 comment · Fixed by #4858
Closed
1 task

Code blocks in MDX render environmental variables #4801

ymcheung opened this issue Sep 19, 2022 · 1 comment · Fixed by #4858
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@ymcheung
Copy link
Contributor

What version of astro are you using?

1.1.1

Are you using an SSR adapter? If so, which one?

Deno Deploy

What package manager are you using?

pnpm

What operating system are you using?

macOS 12

Describe the Bug

I have some import.meta.env in MDX's code blocks and don't want them to be converted. (Just display import.meta.env.XXXXX)

In dev environment, the output is doing well.

However, import.meta.env.SITE becomes undefined (or the url I defined in astro.config.mjs);
import.meta.env.PUBLIC_HOSTNAME becomes (Object.assign(import.meta.env,{HOSTNAME:process.env.HOSTNAME,})).PUBLIC_HOSTNAME in production.

Link to Minimal Reproducible Example

https://codesandbox.io/s/vibrant-chandrasekhar-gbicwd?file=/src/pages/article1.mdx

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Sep 20, 2022
@bholmesdev bholmesdev self-assigned this Sep 21, 2022
@bholmesdev
Copy link
Contributor

Thanks for reporting @ymcheung! Looks like we're missing our environment variable handling in MDX that we use for standard Markdown. Will PR that fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants