Skip to content

Commit b4ed61b

Browse files
committed
fix(@angular-devkit/build-angular): update ssr option definition
This commits updates the `ssr` application builder option definition. The main change is that now the option does not accept the entry-point as a value. Instead it should be passed in the `entry` suboption. Example ```json "ssr": { "entry": "server.ts" } ``` This change in this option is important to allow us in the future to add additional sub options. Like potentially a `platform` or `target`.
1 parent 4784155 commit b4ed61b

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

packages/angular_devkit/build_angular/src/builders/application/options.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,11 @@ export async function normalizeOptions(
210210
let ssrOptions;
211211
if (options.ssr === true) {
212212
ssrOptions = {};
213-
} else if (typeof options.ssr === 'string') {
213+
} else if (typeof options.ssr === 'object') {
214+
const { entry } = options.ssr;
215+
214216
ssrOptions = {
215-
entry: path.join(workspaceRoot, options.ssr),
217+
entry: entry && path.join(workspaceRoot, entry),
216218
};
217219
}
218220

packages/angular_devkit/build_angular/src/builders/application/schema.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,14 @@
447447
"description": "Enable the server bundles to be written to disk."
448448
},
449449
{
450-
"type": "string",
451-
"description": "The server entry-point that when executed will spawn the web server."
450+
"type": "object",
451+
"properties": {
452+
"entry": {
453+
"type": "string",
454+
"description": "The server entry-point that when executed will spawn the web server."
455+
}
456+
},
457+
"additionalProperties": false
452458
}
453459
]
454460
},

packages/schematics/angular/ssr/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ function updateApplicationBuilderWorkspaceConfigRule(
116116
buildTarget.options = {
117117
...buildTarget.options,
118118
prerender: true,
119-
ssr: join(normalize(projectRoot), 'server.ts'),
119+
ssr: {
120+
entry: join(normalize(projectRoot), 'server.ts'),
121+
},
120122
};
121123
});
122124
}

0 commit comments

Comments
 (0)