Skip to content

Commit 1eb2b89

Browse files
gfxcpojer
authored andcommitted
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.
1 parent de26d6d commit 1eb2b89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/shared/ExecutionEnvironment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
export const canUseDOM: boolean = !!(
1111
typeof window !== 'undefined' &&
12-
window.document &&
13-
window.document.createElement
12+
typeof window.document !== 'undefined' &&
13+
typeof window.document.createElement !== 'undefined'
1414
);

0 commit comments

Comments
 (0)