mirror of https://github.com/vuejs/core.git
chore: improve build script to only build package when format is valid
This commit is contained in:
parent
6a185abbe4
commit
ade6ed46dd
|
@ -173,6 +173,17 @@ async function build(target) {
|
|||
return
|
||||
}
|
||||
|
||||
if (formats) {
|
||||
let resolvedFormats = formats.split('+')
|
||||
const pkgFormats = pkg.buildOptions?.formats
|
||||
if (pkgFormats) {
|
||||
resolvedFormats = resolvedFormats.filter(f => pkgFormats.includes(f))
|
||||
}
|
||||
if (!resolvedFormats.length) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// if building a specific format, do not remove dist.
|
||||
if (!formats && existsSync(`${pkgDir}/dist`)) {
|
||||
fs.rmSync(`${pkgDir}/dist`, { recursive: true })
|
||||
|
|
Loading…
Reference in New Issue