Skip to content

Commit 149a1fa

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

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/core/context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export class Context {
8080
return
8181

8282
this._server = server
83-
this._removeUnused = this.options.syncMode !== 'append'
8483
this.setupWatcher(server.watcher)
8584
}
8685

src/core/options.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ export function resolveOptions(options: Options, root: string): ResolvedOptions
7373
throw new Error('[unplugin-vue-components] `extensions` option is required to search for components')
7474
}
7575

76+
// syncMode - `default`: use `append` strategy when using dev server, `overwrite` strategy when using build.
77+
if (resolved.syncMode === 'default') {
78+
resolved.syncMode = process.env.NODE_ENV === 'development' ? 'append' : 'overwrite'
79+
}
80+
7681
resolved.globsExclude = toArray(resolved.globsExclude || [])
7782
.map(i => resolveGlobsExclude(root, i))
7883

0 commit comments

Comments
 (0)