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

Umi 相关问题 #6

Open
wangxingkang opened this issue Mar 27, 2020 · 0 comments
Open

Umi 相关问题 #6

wangxingkang opened this issue Mar 27, 2020 · 0 comments

Comments

@wangxingkang
Copy link
Owner

如何监听文件改变重启 dev server

  1. 使用 chokidar 监听文件变化
  2. 使用 api.restartServer();重启服务
import { chokidar } from '@umijs/utils';

export default (api) {
   const  watcher = chokidar.watch(localFile).on('all', (event) => {
       if (event === 'change') {
          api.restartServer();
        }
    });
}
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

1 participant