vben-admin-thin-next/build/vite/plugin/mock.ts

17 lines
386 B
TypeScript
Raw Normal View History

2021-01-09 23:28:52 +08:00
import { viteMockServe } from 'vite-plugin-mock';
2021-02-08 23:59:47 +08:00
export function configMockPlugin(isBuild: boolean) {
return viteMockServe({
ignore: /^\_/,
mockPath: 'mock',
showTime: true,
localEnabled: !isBuild,
prodEnabled: isBuild,
injectCode: `
import { setupProdMockServer } from '../mock/_createProductionServer';
setupProdMockServer();
`,
2021-02-08 23:59:47 +08:00
});
}