Skip to content

Commit 31b44b9

Browse files
committed
fix: detect when no SSR was set up
1 parent 65686c6 commit 31b44b9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/helpers/setUpEdgeFunction.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,19 @@ const setUpEdgeFunction = async ({ angularJson, projectName, netlifyConfig, cons
3030
return failBuild('Could not find build output directory')
3131
}
3232

33-
console.log(`Writing Angular SSR Edge Function for project "${projectName}" ...`)
34-
3533
netlifyConfig.build.publish = join(outputDir, 'browser')
3634

35+
const serverDistRoot = join(outputDir, 'server')
36+
if (!existsSync(serverDistRoot)) {
37+
console.log('No server output generated, skipping SSR setup.')
38+
return
39+
}
40+
41+
console.log(`Writing Angular SSR Edge Function for project "${projectName}" ...`)
42+
3743
const edgeFunctionDir = join(constants.INTERNAL_EDGE_FUNCTIONS_SRC, 'angular-ssr')
3844
await mkdir(edgeFunctionDir, { recursive: true })
3945

40-
const serverDistRoot = join(outputDir, 'server')
4146
const html = await readFile(join(serverDistRoot, 'index.server.html'), 'utf-8')
4247
const staticFiles = getAllFilesIn(join(outputDir, 'browser')).map(
4348
(path) => `/${relative(join(outputDir, 'browser'), path)}`,

0 commit comments

Comments
 (0)