Skip to content

Commit a8db43a

Browse files
committed
fix(build): use config output path as default
1 parent e7b04ec commit a8db43a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/angular-cli/commands/build.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const BuildCommand = Command.extend({
2525
aliases: ['t', { 'dev': 'development' }, { 'prod': 'production' }]
2626
},
2727
{ name: 'environment', type: String, default: '', aliases: ['e'] },
28-
{ name: 'output-path', type: 'Path', default: 'dist/', aliases: ['o'] },
29-
{ name: 'watch', type: Boolean, default: false, aliases: ['w'] },
28+
{ name: 'output-path', type: 'Path', default: null, aliases: ['o'] },
29+
{ name: 'watch', type: Boolean, default: false, aliases: ['w'] },
3030
{ name: 'watcher', type: String },
3131
{ name: 'suppress-sizes', type: Boolean, default: false },
3232
{ name: 'base-href', type: String, default: null, aliases: ['bh'] },

packages/angular-cli/commands/serve.ts

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export interface ServeTaskOptions {
2222
liveReloadLiveCss?: boolean;
2323
target?: string;
2424
environment?: string;
25-
outputPath?: string;
2625
ssl?: boolean;
2726
sslKey?: string;
2827
sslCert?: string;

packages/angular-cli/tasks/build-webpack.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@ import * as webpack from 'webpack';
55
import { BuildOptions } from '../commands/build';
66
import { NgCliWebpackConfig } from '../models/webpack-config';
77
import { webpackOutputOptions } from '../models/';
8+
import { CliConfig } from '../models/config';
89

910
// Configure build and output;
1011
let lastHash: any = null;
1112

1213
export default <any>Task.extend({
13-
// Options: String outputPath
1414
run: function (runTaskOptions: BuildOptions) {
1515

1616
const project = this.cliProject;
1717

18-
rimraf.sync(path.resolve(project.root, runTaskOptions.outputPath));
18+
const outputDir = runTaskOptions.outputPath || CliConfig.fromProject().config.apps[0].outDir;
19+
rimraf.sync(path.resolve(project.root, outputDir));
20+
1921
const config = new NgCliWebpackConfig(
2022
project,
2123
runTaskOptions.target,
2224
runTaskOptions.environment,
23-
runTaskOptions.outputPath,
25+
outputDir,
2426
runTaskOptions.baseHref
2527
).config;
2628

0 commit comments

Comments
 (0)