diff --git a/.changeset/nice-cougars-hear.md b/.changeset/nice-cougars-hear.md
new file mode 100644
index 000000000..6d14608db
--- /dev/null
+++ b/.changeset/nice-cougars-hear.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes use of import.meta.env.SITE
diff --git a/packages/astro/src/vite-plugin-env/index.ts b/packages/astro/src/vite-plugin-env/index.ts
index 672fe5a0f..71c086865 100644
--- a/packages/astro/src/vite-plugin-env/index.ts
+++ b/packages/astro/src/vite-plugin-env/index.ts
@@ -78,6 +78,7 @@ export default function envVitePlugin({
if (typeof privateEnv === 'undefined') {
privateEnv = getPrivateEnv(config, astroConfig);
if (privateEnv) {
+ privateEnv.SITE = astroConfig.site ? `'${astroConfig.site}'` : 'undefined';
const entries = Object.entries(privateEnv).map(([key, value]) => [
`import.meta.env.${key}`,
value,
diff --git a/packages/astro/test/astro-envs.test.js b/packages/astro/test/astro-envs.test.js
index da2332c9e..5c5f410c4 100644
--- a/packages/astro/test/astro-envs.test.js
+++ b/packages/astro/test/astro-envs.test.js
@@ -35,6 +35,12 @@ describe('Environment Variables', () => {
expect(indexHtml).to.include('http://example.com');
});
+ it('does render destructured builtin SITE env', async () => {
+ let indexHtml = await fixture.readFile('/destructured/index.html');
+
+ expect(indexHtml).to.include('http://example.com');
+ });
+
it('includes public env in client-side JS', async () => {
let dirs = await fixture.readdir('/');
let found = false;
diff --git a/packages/astro/test/fixtures/astro-envs/src/pages/destructured.astro b/packages/astro/test/fixtures/astro-envs/src/pages/destructured.astro
index 25fb95954..e85b9bf81 100644
--- a/packages/astro/test/fixtures/astro-envs/src/pages/destructured.astro
+++ b/packages/astro/test/fixtures/astro-envs/src/pages/destructured.astro
@@ -1,5 +1,6 @@
---
-const { PUBLIC_PLACE, SECRET_PLACE } = import.meta.env;
+const { PUBLIC_PLACE, SECRET_PLACE, SITE } = import.meta.env;
---
{PUBLIC_PLACE}
{SECRET_PLACE}
+{SITE}