Builds fail when MDX souremaps are enabled on files with import.meta.env.*
#9012
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
Astro Info
If this issue only occurs in one browser, which browser is a problem?
n/a
Describe the Bug
When enabling
sourcemaps
in thevite.build
configuration with theMDX
integration, the build will fail if any of the.mdx
files references environment variables.Example MDX Files:
Resulting error:
Tracking the issue back up the stack it appears to be originating from the
recma-stringify
function which is several layers of wrapper around theastring
library, so I suspect that's where the issue actually resides.Looking at this section of code in the
astring
library, I believe that onlyimport(
andimport
syntaxes are supported.Path Forward
I'm not sure the proper path forward on this sort of issue. I suspect this has been solved by other libraries so would switching libraries be easier?
What's the expected result?
Be able to build an Astro site with
sourcemaps
enabled while still using the full power of MDX.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-jmjzta?file=astro.config.mjs
Participation
The text was updated successfully, but these errors were encountered: