fix(svg): ignore empty input

This commit is contained in:
MDLeom 2022-11-06 04:50:36 +00:00
parent a6e2ea0879
commit a6f434ff8d
No known key found for this signature in database
GPG Key ID: 06C236E63CBC68AA
1 changed files with 2 additions and 6 deletions

View File

@ -154,12 +154,8 @@ function minifySvg () {
if (assetTxt.length) { if (assetTxt.length) {
try { try {
const { data } = svgOptimize(assetTxt, { ...options, plugins }) const { data } = svgOptimize(assetTxt, { ...options, plugins })
if (data) { if (verbose) logFn.call(this, assetTxt, data, path, 'svg')
if (verbose) logFn.call(this, assetTxt, data, path, 'svg') resolve(route.set(path, data))
resolve(route.set(path, data))
} else {
reject(new Error(`Path: ${path}\nEmpty svg input`))
}
} catch (err) { } catch (err) {
reject(new Error(`Path: ${path}\n${err}`)) reject(new Error(`Path: ${path}\n${err}`))
} }