From 1eb2b892dfffedfdb57039ef715fc7049f4d538a Mon Sep 17 00:00:00 2001 From: FUJI Goro Date: Thu, 25 Apr 2019 19:28:53 +0900 Subject: [PATCH] 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. --- packages/shared/ExecutionEnvironment.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shared/ExecutionEnvironment.js b/packages/shared/ExecutionEnvironment.js index 9554c8d6464c..2e7af6edd2d6 100644 --- a/packages/shared/ExecutionEnvironment.js +++ b/packages/shared/ExecutionEnvironment.js @@ -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' );