Skip to content

Commit fc3cf07

Browse files
Broccofilipesilva
authored andcommitted
fix(@angular/cli): Add app-shell error msg
If configured app shell app is not configured as platform server throw an error
1 parent 9025b5a commit fc3cf07

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

packages/@angular/cli/commands/build.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { join } from 'path';
77
import { RenderUniversalTaskOptions } from '../tasks/render-universal';
88

99
const Command = require('../ember-cli/lib/models/command');
10-
10+
const SilentError = require('silent-error');
1111

1212
const config = CliConfig.fromProject() || CliConfig.fromGlobal();
1313
const buildConfigDefaults = config.getPaths('defaults.build', [
@@ -246,19 +246,25 @@ const BuildCommand = Command.extend({
246246
ui: this.ui,
247247
});
248248

249-
250-
const buildPromise = buildTask.run(commandOptions);
251-
252-
253249
const clientApp = getAppFromConfig(commandOptions.app);
254250

255251
const doAppShell = commandOptions.target === 'production' &&
256252
(commandOptions.aot === undefined || commandOptions.aot === true) &&
257253
!commandOptions.skipAppShell;
254+
255+
let serverApp: any = null;
256+
if (clientApp.appShell && doAppShell) {
257+
serverApp = getAppFromConfig(clientApp.appShell.app);
258+
if (serverApp.platform !== 'server') {
259+
throw new SilentError(`Shell app's platform is not "server"`);
260+
}
261+
}
262+
263+
const buildPromise = buildTask.run(commandOptions);
264+
258265
if (!clientApp.appShell || !doAppShell) {
259266
return buildPromise;
260267
}
261-
const serverApp = getAppFromConfig(clientApp.appShell.app);
262268

263269
return buildPromise
264270
.then(() => {

0 commit comments

Comments
 (0)