From a30e38856e2e0c153ae925877616e9559f1533b2 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 22 Sep 2020 17:48:51 +0100 Subject: [PATCH] Avoid infinite rebuilds --- lib/image-worker-plugin.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/image-worker-plugin.js b/lib/image-worker-plugin.js index 40d7ed74..3cf41cb4 100644 --- a/lib/image-worker-plugin.js +++ b/lib/image-worker-plugin.js @@ -19,6 +19,8 @@ import glob from 'glob'; const globP = promisify(glob); export default function () { + let previousWorkerContent; + return { name: 'image-worker-plugin', async buildStart() { @@ -56,6 +58,10 @@ export default function () { .flat(Infinity) .join('\n'); + // If nothing's changed, avoid touching the file to avoid infinite rebuilding in watch mode + if (previousWorkerContent === workerFile) return; + previousWorkerContent = workerFile; + const tsConfig = { extends: '../../../generic-tsconfig.json', compilerOptions: {