Skip to content

Commit 6c6f4cb

Browse files
committed
fix: syncMode - default: use append strategy when using dev server, overwrite strategy when using build.
1 parent e59fea4 commit 6c6f4cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/context.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class Context {
4343
this.options = resolveOptions(rawOptions, this.root)
4444
this.sourcemap = rawOptions.sourcemap ?? true
4545
this.generateDeclaration = throttle(500, this._generateDeclaration.bind(this), { noLeading: false })
46-
this._removeUnused = this.options.syncMode === 'overwrite'
46+
this._removeUnused = this.options.syncMode !== 'append'
4747

4848
if (this.options.dumpComponentsInfo) {
4949
const dumpComponentsInfo = this.options.dumpComponentsInfo === true
@@ -80,13 +80,13 @@ export class Context {
8080
return
8181

8282
this._server = server
83-
this._removeUnused = this.options.syncMode !== 'append'
83+
this._removeUnused = this.options.syncMode === 'overwrite'
8484
this.setupWatcher(server.watcher)
8585
}
8686

8787
setupWatcher(watcher: fs.FSWatcher) {
8888
const { globs } = this.options
89-
89+
this._removeUnused = this.options.syncMode === 'overwrite'
9090
watcher
9191
.on('unlink', (path) => {
9292
if (!matchGlobs(path, globs))
@@ -112,7 +112,7 @@ export class Context {
112112
*/
113113
setupWatcherWebpack(watcher: fs.FSWatcher, emitUpdate: (path: string, type: 'unlink' | 'add') => void) {
114114
const { globs } = this.options
115-
115+
this._removeUnused = this.options.syncMode === 'overwrite'
116116
watcher
117117
.on('unlink', (path) => {
118118
if (!matchGlobs(path, globs))

0 commit comments

Comments
 (0)