build: only remove dist directory when building all formats

This commit is contained in:
Evan You 2019-11-06 15:23:50 -05:00
parent d7eab51315
commit 3ec63dbee1

View File

@ -54,7 +54,10 @@ async function build(target) {
const pkgDir = path.resolve(`packages/${target}`)
const pkg = require(`${pkgDir}/package.json`)
await fs.remove(`${pkgDir}/dist`)
// if building a specific format, do not remove dist.
if (!formats) {
await fs.remove(`${pkgDir}/dist`)
}
const env =
(pkg.buildOptions && pkg.buildOptions.env) ||