Skip to content

Commit 79f5ab4

Browse files
committed
Check for syntax errors in angular-cli
Fixes codesandbox#916
1 parent 9f99507 commit 79f5ab4

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

packages/common/templates/angular.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import { decorateSelector } from '../theme';
99
function getAngularCLIEntries(parsed) {
1010
const entries = [];
1111

12-
const app = parsed.apps && parsed.apps[0];
13-
1412
if (parsed) {
13+
const app = parsed.apps && parsed.apps[0];
1514
if (app && app.root && app.main) {
1615
entries.push(absolute(join(app.root, app.main)));
1716
}
@@ -22,33 +21,40 @@ function getAngularCLIEntries(parsed) {
2221

2322
function getAngularJSONEntries(parsed) {
2423
const entries = [];
25-
const defaultProject = parsed.defaultProject;
26-
const project = parsed.projects[defaultProject];
27-
const build = project.architect.build;
2824

29-
if (build.options.main) {
30-
entries.push(absolute(join(project.root, build.options.main)));
25+
if (parsed) {
26+
const defaultProject = parsed.defaultProject;
27+
const project = parsed.projects[defaultProject];
28+
const build = project.architect.build;
29+
30+
if (build.options.main) {
31+
entries.push(absolute(join(project.root, build.options.main)));
32+
}
3133
}
3234

3335
return entries;
3436
}
3537

3638
function getAngularCLIHTMLEntry(parsed) {
37-
const app = parsed.apps && parsed.apps[0];
38-
if (app && app.root && app.index) {
39-
return [absolute(join(app.root, app.index))];
39+
if (parsed) {
40+
const app = parsed.apps && parsed.apps[0];
41+
if (app && app.root && app.index) {
42+
return [absolute(join(app.root, app.index))];
43+
}
4044
}
4145

4246
return [];
4347
}
4448

4549
function getAngularJSONHTMLEntry(parsed) {
46-
const defaultProject = parsed.defaultProject;
47-
const project = parsed.projects[defaultProject];
48-
const build = project.architect.build;
50+
if (parsed) {
51+
const defaultProject = parsed.defaultProject;
52+
const project = parsed.projects[defaultProject];
53+
const build = project.architect.build;
4954

50-
if (build && project.root != null && build.options && build.options.index) {
51-
return [absolute(join(project.root, build.options.index))];
55+
if (build && project.root != null && build.options && build.options.index) {
56+
return [absolute(join(project.root, build.options.index))];
57+
}
5258
}
5359

5460
return [];

0 commit comments

Comments
 (0)