Skip to content

Commit

Permalink
give canUseDOM with a possibility to be a constant (#14194)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gfx authored and cpojer committed Apr 25, 2019
1 parent de26d6d commit 1eb2b89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/shared/ExecutionEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);

0 comments on commit 1eb2b89

Please sign in to comment.