mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
995 B
995 B
title |
---|
Let's talk about my import.meta.env.SITE |
export const modeWorks = import.meta.env.MODE === 'production' ? 'MODE works' : 'MODE does not work!';
export const unknownVar = import.meta.env.UNKNOWN_VAR;
About my import.meta.env.SITE
My import.meta.env.SITE
is so cool, I can put env variables in code!
const site = import.meta.env.SITE;
But I can use import.meta.env properly too
I can compute my site, for example: {new URL('/blog/cool-post', import.meta.env.SITE)}
I can also use import.meta.env
in variable exports: {modeWorks}
I can also use import.meta.env.UNKNOWN_VAR
through exports: "{unknownVar}"
I can also use vars as HTML attributes: