mirror of
https://github.com/wmn1525/grasscutterTools.git
synced 2024-11-23 00:01:38 +00:00
18 lines
582 B
TypeScript
18 lines
582 B
TypeScript
|
/**
|
|||
|
* @name ConfigMockPlugin
|
|||
|
* @description 引入mockjs,本地模拟接口
|
|||
|
*/
|
|||
|
import { viteMockServe } from 'vite-plugin-mock'
|
|||
|
export const ConfigMockPlugin = (isBuild: boolean) => {
|
|||
|
return viteMockServe({
|
|||
|
ignore: /^\_/,
|
|||
|
mockPath: 'mock',
|
|||
|
localEnabled: !isBuild,
|
|||
|
prodEnabled: false, //实际开发请关闭,会影响打包体积
|
|||
|
// https://github.com/anncwb/vite-plugin-mock/issues/9
|
|||
|
injectCode: `
|
|||
|
import { setupProdMockServer } from '../mock/_createProdMockServer';
|
|||
|
setupProdMockServer();
|
|||
|
`,
|
|||
|
})
|
|||
|
}
|