mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 10:29:48 +02:00
Change export of "is-dev" to be a constant to improve code compilation
This commit is contained in:
@@ -9,7 +9,7 @@ import Leaf from './leaf'
|
||||
import Void from './void'
|
||||
import scrollTo from '../utils/scroll-to'
|
||||
import warning from '../utils/warning'
|
||||
import isDev from '../utils/is-dev'
|
||||
import IS_DEV from '../utils/is-dev'
|
||||
|
||||
/**
|
||||
* Debug.
|
||||
@@ -101,7 +101,7 @@ class Node extends React.Component {
|
||||
|
||||
// If the node has changed, update.
|
||||
if (nextProps.node != this.props.node) {
|
||||
if (!isDev() || !Immutable.is(nextProps.node, this.props.node)) {
|
||||
if (!IS_DEV || !Immutable.is(nextProps.node, this.props.node)) {
|
||||
return true
|
||||
} else {
|
||||
warning('Encountered different references for identical node values in "shouldComponentUpdate". Check that you are preserving references for the following node:\n', nextProps.node)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const __DEV__ = (
|
||||
const IS_DEV = (
|
||||
typeof process !== 'undefined' &&
|
||||
process.env &&
|
||||
process.env.NODE_ENV !== 'production'
|
||||
@@ -6,9 +6,7 @@ const __DEV__ = (
|
||||
|
||||
/**
|
||||
* Return true if running slate in development
|
||||
* @return {Boolean} dev
|
||||
* @type {Boolean}
|
||||
*/
|
||||
|
||||
export default function isDev() {
|
||||
return __DEV__
|
||||
}
|
||||
export default IS_DEV
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import isDev from './is-dev'
|
||||
import IS_DEV from './is-dev'
|
||||
|
||||
/**
|
||||
* Log a development warning.
|
||||
@@ -6,7 +6,7 @@ import isDev from './is-dev'
|
||||
*/
|
||||
|
||||
export default function warning(message, ...more) {
|
||||
if (!isDev()) {
|
||||
if (!IS_DEV) {
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user