Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 7f2ce67

Browse files
committed
fix(@nguniversal/common): mark bootstrap in RenderOptions as non required
This option is not required in the common engine. Closes: #2893 (cherry picked from commit 344a695)
1 parent 709a39e commit 7f2ce67

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

modules/common/engine/src/engine.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { URL } from 'url';
1515

1616
/** These are the allowed options for the render */
1717
export interface RenderOptions {
18-
bootstrap: Type<{}>;
18+
bootstrap?: Type<{}>;
1919
providers?: StaticProvider[];
2020
url?: string;
2121
document?: string;
@@ -101,6 +101,11 @@ export class CommonEngine {
101101
}
102102

103103
const moduleOrFactory = this.module || opts.bootstrap;
104+
105+
if (!moduleOrFactory) {
106+
throw new Error('A module or bootstrap option must be provided.');
107+
}
108+
104109
const html = await renderModule(moduleOrFactory, { extraProviders });
105110
if (!inlineCriticalCss) {
106111
return html;

modules/express-engine/src/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import type { Request, Response } from 'express';
1414
/**
1515
* These are the allowed options for the engine
1616
*/
17-
export type NgSetupOptions = Pick<
18-
CommonRenderOptions,
19-
'bootstrap' | 'providers' | 'publicPath' | 'inlineCriticalCss'
20-
>;
17+
export interface NgSetupOptions
18+
extends Pick<CommonRenderOptions, 'providers' | 'publicPath' | 'inlineCriticalCss'> {
19+
bootstrap: NonNullable<CommonRenderOptions['bootstrap']>;
20+
}
2121

2222
/**
2323
* These are the allowed options for the render

0 commit comments

Comments
 (0)