mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
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.
15 lines
377 B
JavaScript
15 lines
377 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
export const canUseDOM: boolean = !!(
|
|
typeof window !== 'undefined' &&
|
|
typeof window.document !== 'undefined' &&
|
|
typeof window.document.createElement !== 'undefined'
|
|
);
|