mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
give canUseDOM with a possibility to be a constant (#14194)
https://webpack.js.org/plugins/define-plugin/ Webpack's DefinePlugin has the ability to replace `typeof expr` to a constant in compile-time, which should lead to better dead-code-elimination.
This commit is contained in:
committed by
Christoph Nakazawa
parent
de26d6dd36
commit
1eb2b892df
@@ -9,6 +9,6 @@
|
||||
|
||||
export const canUseDOM: boolean = !!(
|
||||
typeof window !== 'undefined' &&
|
||||
window.document &&
|
||||
window.document.createElement
|
||||
typeof window.document !== 'undefined' &&
|
||||
typeof window.document.createElement !== 'undefined'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user