Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

参数应该改成可选的 #42

Closed
jiyingzhi opened this issue Aug 12, 2021 · 2 comments
Closed

参数应该改成可选的 #42

jiyingzhi opened this issue Aug 12, 2021 · 2 comments

Comments

@jiyingzhi
Copy link

No description provided.

@anncwb
Copy link
Collaborator

anncwb commented Aug 23, 2021

能描述下你的问题吗

@jiyingzhi
Copy link
Author

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 会报错

@anncwb anncwb closed this as completed in 5b4e946 Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants