Skip to content

Commit e959698

Browse files
fix(build): scope adapter build to ssr environment (#15563)
* fix(build): scope adapter build to ssr environment * Update .changeset/full-carpets-hide.md Co-authored-by: Florian Lefebvre <[email protected]> --------- Co-authored-by: Florian Lefebvre <[email protected]>
1 parent aef04b9 commit e959698

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.changeset/full-carpets-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes an issue where warnings would be logged during the build using one of the official adapters

packages/astro/src/vite-plugin-adapter-config/index.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Plugin as VitePlugin } from 'vite';
22
import { isAstroServerEnvironment } from '../environments.js';
33
import type { AstroSettings } from '../types/astro.js';
44
import { fileURLToPath } from 'node:url';
5+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';
56

67
// This is used by Cloudflare's optimizeDeps
78
const VIRTUAL_CLIENT_ID = 'virtual:astro:adapter-config/client';
@@ -14,13 +15,17 @@ export function vitePluginAdapterConfig(settings: AstroSettings): VitePlugin {
1415
const { adapter } = settings;
1516
if (adapter && adapter.entrypointResolution === 'auto' && adapter.serverEntrypoint) {
1617
return {
17-
build: {
18-
rollupOptions: {
19-
input: {
20-
index:
21-
typeof adapter.serverEntrypoint === 'string'
22-
? adapter.serverEntrypoint
23-
: fileURLToPath(adapter.serverEntrypoint),
18+
environments: {
19+
[ASTRO_VITE_ENVIRONMENT_NAMES.ssr]: {
20+
build: {
21+
rollupOptions: {
22+
input: {
23+
index:
24+
typeof adapter.serverEntrypoint === 'string'
25+
? adapter.serverEntrypoint
26+
: fileURLToPath(adapter.serverEntrypoint),
27+
},
28+
},
2429
},
2530
},
2631
},

0 commit comments

Comments
 (0)