From 69aee430b3f0856c4ba1c30c63f0b04ea440e419 Mon Sep 17 00:00:00 2001 From: Jon Uhlmann Date: Sun, 1 Aug 2021 02:16:35 +0200 Subject: [PATCH] Fix: Get size of source map --- postcss.mjs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/postcss.mjs b/postcss.mjs index cd26b0d..24e07c4 100644 --- a/postcss.mjs +++ b/postcss.mjs @@ -180,11 +180,15 @@ function css(css, file, time) { if (result.map) { const file = `${to}.map`; const map = result.map.toString(); - tasks.push(fs.outputFile(file, map)); - if (!watch && index === 0) { - const size = fs.statSync(file)?.size; - mapFilesize = humanFileSize(size); - } + tasks.push( + fs.outputFile(file, map, () => { + if (!watch && index === 0) { + const size = fs.statSync(file)?.size; + mapFilesize = humanFileSize(size); + } + }) + ); + if (compression) { tasks.push(writeGz(file, map)); tasks.push(writeBr(file, map));