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:
FUJI Goro
2019-04-25 19:28:53 +09:00
committed by Christoph Nakazawa
parent de26d6dd36
commit 1eb2b892df

View File

@@ -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'
);