mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-04 21:18:16 +08:00
15 lines
381 B
TypeScript
15 lines
381 B
TypeScript
|
import { viteMockServe } from 'vite-plugin-mock'
|
||
|
|
||
|
export default function createMock(env, isBuild) {
|
||
|
const { VITE_BUILD_MOCK } = env
|
||
|
return viteMockServe({
|
||
|
mockPath: 'src/mock',
|
||
|
localEnabled: !isBuild,
|
||
|
prodEnabled: isBuild && VITE_BUILD_MOCK === 'true',
|
||
|
injectCode: `
|
||
|
import { setupProdMockServer } from './mockProdServer';
|
||
|
setupProdMockServer();
|
||
|
`,
|
||
|
})
|
||
|
}
|