index.ts 346 B

1234567891011121314
  1. import { viteMockServe } from 'vite-plugin-mock'
  2. export const createMock = (localEnabled: boolean, prodEnabled: boolean) => {
  3. return viteMockServe({
  4. logger: false,
  5. ignore: /^index/,
  6. localEnabled,
  7. prodEnabled,
  8. injectCode: `
  9. import { setupProdMockServer } from '/mock/index'
  10. setupProdMockServer()
  11. `,
  12. })
  13. }