Skip to content

Commit

Permalink
Only append serverIslands route if there is one
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Sep 9, 2024
1 parent 21cc6fe commit 9f148df
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/astro/src/core/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@ class AstroBuilder {

const { internals, ssrOutputChunkNames, contentFileNames } = await viteBuild(opts);

const hasServerIslands = this.settings.serverIslandNameMap.size > 0;
// Error if there are server islands but no adapter provided.
if(this.settings.serverIslandNameMap.size && !this.settings.adapter) {
if(hasServerIslands && !this.settings.adapter) {
throw new AstroError(AstroErrorData.NoAdapterInstalledServerIslands);
}

Expand All @@ -231,7 +232,7 @@ class AstroBuilder {
routes: Object.values(allPages)
.flat()
.map((pageData) => pageData.route)
.concat(getServerIslandRouteData(this.settings.config)),
.concat(hasServerIslands ? getServerIslandRouteData(this.settings.config) : []),
logging: this.logger,
cacheManifest: internals.cacheManifestUsed,
});
Expand Down

0 comments on commit 9f148df

Please sign in to comment.