forked from wangjiadong/comp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
467 B
19 lines
467 B
/** |
|
* Mock plugin for development and production. |
|
* https://github.com/anncwb/vite-plugin-mock |
|
*/ |
|
import { viteMockServe } from 'vite-plugin-mock'; |
|
|
|
export function configMockPlugin(isBuild: boolean) { |
|
return viteMockServe({ |
|
ignore: /^\_/, |
|
mockPath: 'mock', |
|
localEnabled: !isBuild, |
|
prodEnabled: isBuild, |
|
injectCode: ` |
|
import { setupProdMockServer } from '../mock/_createProductionServer'; |
|
|
|
setupProdMockServer(); |
|
`, |
|
}); |
|
}
|
|
|