Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion plugin/src/core/mockCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class MockCompiler extends EventEmitter {
return this._mockData
}

run(): void {
run(watch?: boolean): void {
const { include, exclude } = this.options
/**
* 使用 rollup 提供的 include/exclude 规则,
Expand All @@ -68,6 +68,9 @@ export class MockCompiler extends EventEmitter {
.then(loadList => promiseParallel(loadList, 10))
.then(() => this.updateMockList())

if (!watch)
return

this.watchMockEntry()
this.watchDeps()

Expand Down
2 changes: 1 addition & 1 deletion plugin/src/core/mockMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function mockServerMiddleware(
*/
const compiler = createMockCompiler(options)

compiler.run()
compiler.run(!!server)

/**
* 监听 mock 文件是否发生变更,如何配置了 reload 为 true,
Expand Down