mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-13 09:17:20 +00:00
Avoid infinite rebuilds
This commit is contained in:
@@ -19,6 +19,8 @@ import glob from 'glob';
|
|||||||
const globP = promisify(glob);
|
const globP = promisify(glob);
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
|
let previousWorkerContent;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'image-worker-plugin',
|
name: 'image-worker-plugin',
|
||||||
async buildStart() {
|
async buildStart() {
|
||||||
@@ -56,6 +58,10 @@ export default function () {
|
|||||||
.flat(Infinity)
|
.flat(Infinity)
|
||||||
.join('\n');
|
.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 = {
|
const tsConfig = {
|
||||||
extends: '../../../generic-tsconfig.json',
|
extends: '../../../generic-tsconfig.json',
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
|
|||||||
Reference in New Issue
Block a user