Skip to content

Commit 66ce243

Browse files
catullMRHarrison
authored andcommitted
fix(@angular/cli): Bail out if output path is the root folder (angular#4490)
`ng serve` --output-path=. would wipe out the entire root folder.
1 parent 976d9fd commit 66ce243

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export default Task.extend({
2424
const appConfig = projectConfig.apps[0];
2525

2626
const outputPath = serveTaskOptions.outputPath || appConfig.outDir;
27+
if (this.project.root === outputPath) {
28+
throw new SilentError ('Output path MUST not be project root directory!');
29+
}
2730
rimraf.sync(path.resolve(this.project.root, outputPath));
2831

2932
const serveDefaults = {

0 commit comments

Comments
 (0)