Skip to content

Commit 41651e8

Browse files
vsavkinfilipesilva
authored andcommitted
feat(@angular/cli): improve error messages for apps that do not have 'main' defined
1 parent 7da90af commit 41651e8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export default Task.extend({
2626
if (config.project && config.project.ejected) {
2727
throw new SilentError('An ejected project cannot use the build command anymore.');
2828
}
29+
if (! app.main) {
30+
throw new SilentError(`An app without 'main' cannot use the build command.`);
31+
}
2932
if (runTaskOptions.deleteOutputPath) {
3033
fs.removeSync(path.resolve(this.project.root, outputPath));
3134
}

packages/@angular/cli/tasks/test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export default Task.extend({
2121
if (appConfig.platform === 'server') {
2222
throw new SilentError('ng test for platform server applications is coming soon!');
2323
}
24+
if (! appConfig.main) {
25+
throw new SilentError(`An app without 'main' cannot use the test command.`);
26+
}
2427

2528
return new Promise((resolve) => {
2629
const karma = requireProjectModule(projectRoot, 'karma');

0 commit comments

Comments
 (0)