diff --git a/packages/@angular/cli/tasks/serve.ts b/packages/@angular/cli/tasks/serve.ts index 6a376f35ac86..10458b4f9938 100644 --- a/packages/@angular/cli/tasks/serve.ts +++ b/packages/@angular/cli/tasks/serve.ts @@ -24,6 +24,9 @@ export default Task.extend({ const appConfig = projectConfig.apps[0]; const outputPath = serveTaskOptions.outputPath || appConfig.outDir; + if (this.project.root === outputPath) { + throw new SilentError ('Output path MUST not be project root directory!'); + } rimraf.sync(path.resolve(this.project.root, outputPath)); const serveDefaults = {