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:
parent
c86f0c6e3e
commit
5156c4f90e
2 changed files with 8 additions and 1 deletions
5
.changeset/pink-ghosts-end.md
Normal file
5
.changeset/pink-ghosts-end.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: build fail upon have 'process.env' in \*.md file.
|
|
@ -14,7 +14,9 @@ import { viteID } from '../core/util.js';
|
||||||
* in our JS representation of modules like Markdown
|
* in our JS representation of modules like Markdown
|
||||||
*/
|
*/
|
||||||
export function escapeViteEnvReferences(code: string) {
|
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) {
|
export function getFileInfo(id: string, config: AstroConfig) {
|
||||||
|
|
Loading…
Reference in a new issue