From b51b855794866f3e6a0ef7dfc5672d5c1c717831 Mon Sep 17 00:00:00 2001 From: MYCOIN Date: Fri, 8 Apr 2022 06:52:26 +0800 Subject: [PATCH] feat: [auto-commit] fix: _sizeInfo npe (#935) * feat: [auto-commit] fix: _sizeInfo npe * docs: Adding changeset Co-authored-by: Ryan Christian --- .changeset/clean-shoes-applaud.md | 5 +++++ src/index.js | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changeset/clean-shoes-applaud.md diff --git a/.changeset/clean-shoes-applaud.md b/.changeset/clean-shoes-applaud.md new file mode 100644 index 00000000..019f24a9 --- /dev/null +++ b/.changeset/clean-shoes-applaud.md @@ -0,0 +1,5 @@ +--- +'microbundle': patch +--- + +Don't attempt to write build stats in watch mode when there has been a build error/sizeInfo is `undefined` diff --git a/src/index.js b/src/index.js index d5a77954..deae019b 100644 --- a/src/index.js +++ b/src/index.js @@ -177,9 +177,11 @@ function doWatch(options, cwd, steps) { } } if (e.code === 'END') { - options._sizeInfo.then(text => { - stdout(`Wrote ${text.trim()}`); - }); + if (options._sizeInfo) { + options._sizeInfo.then(text => { + stdout(`Wrote ${text.trim()}`); + }); + } if (typeof onBuild === 'function') { onBuild(e); }