From 6c6f4cbd8381a49671d0b1f093819d77a0db3be5 Mon Sep 17 00:00:00 2001 From: Xiawei Date: Fri, 26 Sep 2025 14:55:27 +0800 Subject: [PATCH] fix: syncMode - `default`: use `append` strategy when using dev server, `overwrite` strategy when using build. --- src/core/context.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/context.ts b/src/core/context.ts index 3cc91bbf..a4cdb098 100644 --- a/src/core/context.ts +++ b/src/core/context.ts @@ -43,7 +43,7 @@ export class Context { this.options = resolveOptions(rawOptions, this.root) this.sourcemap = rawOptions.sourcemap ?? true this.generateDeclaration = throttle(500, this._generateDeclaration.bind(this), { noLeading: false }) - this._removeUnused = this.options.syncMode === 'overwrite' + this._removeUnused = this.options.syncMode !== 'append' if (this.options.dumpComponentsInfo) { const dumpComponentsInfo = this.options.dumpComponentsInfo === true @@ -80,13 +80,13 @@ export class Context { return this._server = server - this._removeUnused = this.options.syncMode !== 'append' + this._removeUnused = this.options.syncMode === 'overwrite' this.setupWatcher(server.watcher) } setupWatcher(watcher: fs.FSWatcher) { const { globs } = this.options - + this._removeUnused = this.options.syncMode === 'overwrite' watcher .on('unlink', (path) => { if (!matchGlobs(path, globs)) @@ -112,7 +112,7 @@ export class Context { */ setupWatcherWebpack(watcher: fs.FSWatcher, emitUpdate: (path: string, type: 'unlink' | 'add') => void) { const { globs } = this.options - + this._removeUnused = this.options.syncMode === 'overwrite' watcher .on('unlink', (path) => { if (!matchGlobs(path, globs))