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.
FUJI Goro committed
Apr 25, 2019 at 19:28 UTC
1eb2b892dfffedfdb57039ef715fc7049f4d538a
1 file changed
+2
-2
packages/shared/ExecutionEnvironment.js
+2
-2
@@ -9,6 +9,6 @@
9
10
export const canUseDOM: boolean = !!(
11
typeof window !== 'undefined' &&
12
- window.document &&
13
- window.document.createElement
12
+ typeof window.document !== 'undefined' &&
13
+ typeof window.document.createElement !== 'undefined'
14
);