Skip to content

Commit 3b0f657

Browse files
committed
fix(@angular/cli): delete only dist content
Fix #5925
1 parent 250d35d commit 3b0f657

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default Task.extend({
2727
if (config.project && config.project.ejected) {
2828
throw new SilentError('An ejected project cannot use the build command anymore.');
2929
}
30-
rimraf.sync(path.resolve(project.root, outputPath));
30+
rimraf.sync(`${path.resolve(project.root, outputPath)}/*`);
3131

3232
const webpackConfig = new NgCliWebpackConfig(runTaskOptions, app).buildConfig();
3333
const webpackCompiler = webpack(webpackConfig);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default Task.extend({
3131
if (projectConfig.project && projectConfig.project.ejected) {
3232
throw new SilentError('An ejected project cannot use the build command anymore.');
3333
}
34-
rimraf.sync(path.resolve(this.project.root, outputPath));
34+
rimraf.sync(`${path.resolve(this.project.root, outputPath)}/*`);
3535

3636
const serveDefaults = {
3737
// default deployUrl to '' on serve to prevent the default from .angular-cli.json

tests/e2e/tests/build/fail-build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ export default function() {
66
return deleteFile('src/app/app.component.ts')
77
// This is supposed to fail since there's a missing file
88
.then(() => expectToFail(() => ng('build')))
9-
// Failed builds don't leave behind dist/
10-
.then(() => expectToFail(() => expectFileToExist('dist/')));
9+
// Failed builds don't leave behind files inside dist/
10+
.then(() => expectToFail(() => expectFileToExist('dist/main.bundle.js')));
1111
}

0 commit comments

Comments
 (0)