diff --git a/packages/fes-preset-built-in/src/utils/generateFiles.js b/packages/fes-preset-built-in/src/utils/generateFiles.js index b3be02d0..ddc0534f 100644 --- a/packages/fes-preset-built-in/src/utils/generateFiles.js +++ b/packages/fes-preset-built-in/src/utils/generateFiles.js @@ -12,7 +12,7 @@ export default async ({ api, watch }) => { }); } - const watchers = []; + let watchers = []; await generate(); @@ -20,6 +20,7 @@ export default async ({ api, watch }) => { watchers.forEach((watcher) => { watcher.close(); }); + watchers = []; } function createWatcher(path) { @@ -34,6 +35,7 @@ export default async ({ api, watch }) => { await generate(); }, 100) ); + watchers.push(watcher); } if (watch) {