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: {