修复mock文件引入后缀错误

This commit is contained in:
hooray 2022-09-26 00:28:19 +08:00
parent 03a10f569c
commit 3a196d6809

View File

@ -1,9 +1,9 @@
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer' import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'
const mocks: any[] = [] const mocks: any[] = []
const mockContext: any = import.meta.glob('./mock/*.js', { eager: true }) const mockContext = import.meta.glob('./mock/*.ts', { eager: true })
Object.keys(mockContext).forEach((v) => { Object.keys(mockContext).forEach((v) => {
mocks.push(...mockContext[v].default) mocks.push(...(mockContext[v] as any).default)
}) })
export function setupProdMockServer() { export function setupProdMockServer() {