diff --git a/src/commands/build.ts b/src/commands/build.ts index 305769d..6cb4897 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -37,6 +37,11 @@ export default class Build extends Command { char: 's', description: 'Silent mode' }), + clean: Flags.boolean({ + char: 'c', + description: 'Clean the output directory', + default: false, + }), mode: Flags.custom({ options: ['production', 'prod', 'development', 'dev'], default: 'production', @@ -88,7 +93,7 @@ export default class Build extends Command { try { const stats = await runWebpack({ - clean: !flags.output, + clean: flags.output ? false : flags.clean, projectDir: directory, outputDir: flags.output ? upath.resolve(upath.dirname(flags.output)) : outputDir, outputFileName: flags.output ? upath.basename(flags.output) : undefined, diff --git a/src/lib/PhatCommandBase.ts b/src/lib/PhatCommandBase.ts index e863d5f..d6b00f4 100644 --- a/src/lib/PhatCommandBase.ts +++ b/src/lib/PhatCommandBase.ts @@ -234,7 +234,7 @@ export default abstract class PhatCommandBase extends Command { try { ux.action.start('Creating an optimized build') const stats = await runWebpack({ - clean: true, + clean: false, projectDir: directory, customWebpack: this.parsedFlags.webpack, buildEntries: {