diff --git a/lib/xml.js b/lib/xml.js index 264345d..9d5799f 100644 --- a/lib/xml.js +++ b/lib/xml.js @@ -1,8 +1,9 @@ 'use strict' -const { minify: compressXml } = require('minify-xml') const { match, logFn } = require('./tools') -function minifyXml() { +async function minifyXml() { + const { minify: compressXml } = await import('minify-xml') + const hexo = this const options = hexo.config.minify.xml @@ -11,7 +12,7 @@ function minifyXml() { const routeList = route.list() const { globOptions, include, verbose } = options - return Promise.all((match(routeList, include, globOptions)).map(path => { + await Promise.all((match(routeList, include, globOptions)).map(path => { return new Promise((/** @type {(value: void) => void} */ resolve, reject) => { const assetPath = route.get(path) let assetTxt = '' diff --git a/package.json b/package.json index 33d895c..82a2b89 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "clean-css": "^5.1.2", "html-minifier-terser": "^7.2.0", "micromatch": "^4.0.2", - "minify-xml": "^3.2.0", + "minify-xml": "^4.5.2", "svgo": "^3.0.0", "terser": "^5.3.0" },