Skip to content

Commit f6131f9

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

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/context.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ 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+
47+
// syncMode - `default`: use `append` strategy when using dev server, `overwrite` strategy when using build.
48+
const syncMode = this.options.syncMode === 'default' ? (process.env.NODE_ENV === 'development' ? 'append' : 'overwrite') : this.options.syncMode
49+
this._removeUnused = syncMode === 'overwrite'
4750

4851
if (this.options.dumpComponentsInfo) {
4952
const dumpComponentsInfo = this.options.dumpComponentsInfo === true
@@ -80,7 +83,6 @@ export class Context {
8083
return
8184

8285
this._server = server
83-
this._removeUnused = this.options.syncMode !== 'append'
8486
this.setupWatcher(server.watcher)
8587
}
8688

0 commit comments

Comments
 (0)