Skip to content

Commit

Permalink
fix: build fail upon have 'process.env' in *.md file. (#7257)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrthiti authored Jun 1, 2023
1 parent c86f0c6 commit 5156c4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pink-ghosts-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

fix: build fail upon have 'process.env' in \*.md file.
4 changes: 3 additions & 1 deletion packages/astro/src/vite-plugin-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5156c4f

Please sign in to comment.