From 3dda648f0f52a7b83171ddcb5f4b27edcb47912f Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Mon, 8 Aug 2022 15:15:24 -0400 Subject: [PATCH] refactor: move `generateRound = 0` to `buildEnd` (#390) - 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 6195b3e..c3a27a2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -197,8 +197,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; @@ -267,6 +265,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();