Skip to content

Commit

Permalink
fix: 修正插件配置选项中ignore的函数形式的处理逻辑 (#128)
Browse files Browse the repository at this point in the history
之前函数形式与正则形式的处理逻辑是相反的,修改后保证二者逻辑统一
  • Loading branch information
wangys4dev authored Feb 24, 2024
1 parent 8f1a6b1 commit 9eff206
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/vite-plugin-mock/src/createMockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ function createWatch(opt: ViteMockOptions, config: ResolvedConfig) {
})
}


// clear cache
function cleanRequireCache(opt: ViteMockOptions) {
if (typeof require === 'undefined' || !require.cache) {
Expand All @@ -152,7 +151,6 @@ function cleanRequireCache(opt: ViteMockOptions) {
})
}


function parseJson(req: IncomingMessage): Promise<Recordable> {
return new Promise((resolve) => {
let body = ''
Expand Down Expand Up @@ -194,7 +192,7 @@ async function getMockConfig(opt: ViteMockOptions, config: ResolvedConfig) {
return true
}
if (isFunction(ignore)) {
return ignore(item)
return !ignore(item)
}
if (isRegExp(ignore)) {
return !ignore.test(path.basename(item))
Expand Down

0 comments on commit 9eff206

Please sign in to comment.