From 1081717aa5faa9b77009ab9659ca5b5ba8e044a0 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Fri, 22 Jul 2022 13:19:19 -0400 Subject: [PATCH] refactor: move `generateRound = 0` to `buildEnd` - since the `buildEnd` hook exists nowadays, we can just reset it there, right before `generateBundle` is called for each output and increments it per output - also modify the comment to account for this change and the fact that `buildEnd` exists and is used nowadays --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 6ec64ddf..055c9c7f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -196,8 +196,6 @@ const typescript: PluginImpl = (options) => transform(code, id) { - generateRound = 0; // in watch mode transform call resets generate count (used to avoid printing too many copies of the same error messages) - if (!filter(id)) return undefined; @@ -266,6 +264,8 @@ const typescript: PluginImpl = (options) => buildEnd(err) { + generateRound = 0; // in watch mode, buildEnd resets generate count just before generateBundle for each output + if (err) { buildDone();