Skip to content

Commit 93705b2

Browse files
filipesilvaMRHarrison
authored andcommitted
fix(serve): delete dist on serve (angular#4293)
`ng serve` will serve the app from memory, but it's easy to think that it just serves what's in `dist/`. This way, `dist/` is deleted on `ng serve` and users will not have a `dist/` dir where they might think the files are being served from. Partially address angular#4290
1 parent c159923 commit 93705b2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/angular-cli/tasks/serve.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
33
import * as chalk from 'chalk';
4+
import * as rimraf from 'rimraf';
45
const SilentError = require('silent-error');
56
const Task = require('../ember-cli/lib/models/task');
67
import * as webpack from 'webpack';
@@ -22,6 +23,9 @@ export default Task.extend({
2223
const projectConfig = CliConfig.fromProject().config;
2324
const appConfig = projectConfig.apps[0];
2425

26+
const outputPath = serveTaskOptions.outputPath || appConfig.outDir;
27+
rimraf.sync(path.resolve(this.project.root, outputPath));
28+
2529
const serveDefaults = {
2630
// default deployUrl to '' on serve to prevent the default from angular-cli.json
2731
deployUrl: ''

0 commit comments

Comments
 (0)