Skip to content

Commit 488185b

Browse files
authored
fix(@angular/cli): Bail out if output path is the root folder pt2 (#4518)
Followup from #4490
1 parent 59029c3 commit 488185b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as rimraf from 'rimraf';
22
import * as path from 'path';
33
const Task = require('../ember-cli/lib/models/task');
4+
const SilentError = require('silent-error');
45
import * as webpack from 'webpack';
56
import { BuildTaskOptions } from '../commands/build';
67
import { NgCliWebpackConfig } from '../models/webpack-config';
@@ -14,6 +15,9 @@ export default Task.extend({
1415
const project = this.cliProject;
1516

1617
const outputPath = runTaskOptions.outputPath || CliConfig.fromProject().config.apps[0].outDir;
18+
if (project.root === outputPath) {
19+
throw new SilentError ('Output path MUST not be project root directory!');
20+
}
1721
rimraf.sync(path.resolve(project.root, outputPath));
1822

1923
const webpackConfig = new NgCliWebpackConfig(runTaskOptions).config;

0 commit comments

Comments
 (0)