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

feat: don't use console.warn in node env #38

Merged
merged 1 commit into from
Apr 24, 2017

Conversation

dead-horse
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 82.695% when pulling 7e1f45f on dead-horse:dont-warn-in-node into 4c02e01 on yiminghe:master.

@@ -3,7 +3,8 @@ const formatRegExp = /%[sdj%]/g;
let warning2 = () => {
};

if (process.env.NODE_ENV !== 'production') {
// don't print warning message when in production env or node runtime
if (process.env.NODE_ENV !== 'production' && typeof global === 'undefined') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否有更好的区分前后端运行时的方式? @yiminghe

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeof window !=='undefined'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有些同构的解决方案,是不是会在 node 全局注入一个 window 对象?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不会,不要那种方案的

@yiminghe yiminghe merged commit 1a72c0e into yiminghe:master Apr 24, 2017
@dead-horse dead-horse deleted the dont-warn-in-node branch April 24, 2017 03:13
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

Successfully merging this pull request may close these issues.

None yet

3 participants