0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix: build fail upon have 'process.env' in *.md file. (#7257)

This commit is contained in:
Thiti Yamsung 2023-06-01 21:34:02 +07:00 committed by GitHub
parent c86f0c6e3e
commit 5156c4f90e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
fix: build fail upon have 'process.env' in \*.md file.

View file

@ -14,7 +14,9 @@ import { viteID } from '../core/util.js';
* in our JS representation of modules like Markdown
*/
export function escapeViteEnvReferences(code: string) {
return code.replace(/import\.meta\.env/g, 'import\\u002Emeta.env');
return code
.replace(/import\.meta\.env/g, 'import\\u002Emeta.env')
.replace(/process\.env/g, 'process\\u002Eenv');
}
export function getFileInfo(id: string, config: AstroConfig) {