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

Disable HotImport in PRODUCTION Environment #907

Closed
huan opened this issue Oct 23, 2017 · 3 comments
Closed

Disable HotImport in PRODUCTION Environment #907

huan opened this issue Oct 23, 2017 · 3 comments

Comments

@huan
Copy link
Member

huan commented Oct 23, 2017

the hotImport from module hot-import will enable us to automatically reload listeners of Wechaty.

Should be automatically disabled if process.env.NODE_ENV === 'production'.

See:

https://github.com/Chatie/wechaty/blob/dd2238de97cf349d8349aca10d1975600fd819e6/src/wechaty.ts#L365-L372

@xinbenlv
Copy link
Contributor

Should the WeChaty provide this feature out of box or should it be configurable and overridable by the user?

@huan
Copy link
Member Author

huan commented Oct 28, 2017

My opinion is to provide this feature out of the box.

And if process.env.NODE_ENV === 'production', then we should disable all the watchers inside hotImport because it should be not necessary and will cost some CPU circles.

The solution is to call hotImport() with the second parameter watch = false, like: hotImport(absoluteFilename, false).

@huan
Copy link
Member Author

huan commented Jul 16, 2018

Fixed by the latest commit.

@huan huan closed this as completed Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants