vbenjs / vite-plugin-mock

A mock plugin for vite.use mockjs.
MIT License
621 stars 96 forks source link

参数应该改成可选的 #42

Closed jiyingzhi closed 3 years ago

anncwb commented 3 years ago

能描述下你的问题吗

jiyingzhi commented 3 years ago
import { UserConfigExport, ConfigEnv } from 'vite';

import { viteMockServe } from 'vite-plugin-mock';
import vue from '@vitejs/plugin-vue';

export default ({ command }: ConfigEnv): UserConfigExport => {
  return {
    plugins: [
      vue(),
      viteMockServe({
        // default
        mockPath: 'mock',
        localEnabled: command === 'serve',
      }),
    ],
  };
};

如果不传参数,TS 会报错