diff --git a/rollup.config.js b/rollup.config.js index 3e919978..18b5986d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -45,7 +45,7 @@ export default [ babelHelpers: 'runtime', }), replace({ - 'process.env.NODE_ENV': JSON.stringify(processEnv), + __ENV__: JSON.stringify(processEnv), __REACT_FLOW_VERSION__: JSON.stringify(pkg.version), }), svgr(), diff --git a/src/container/ReactFlow/index.tsx b/src/container/ReactFlow/index.tsx index 0593fa8f..7b67d7e7 100644 --- a/src/container/ReactFlow/index.tsx +++ b/src/container/ReactFlow/index.tsx @@ -1,7 +1,7 @@ import React, { useMemo, CSSProperties, HTMLAttributes, MouseEvent, WheelEvent } from 'react'; import cc from 'classcat'; -const nodeEnv: string = process.env.NODE_ENV as string; +const nodeEnv: string = __ENV__ as string; if (nodeEnv !== 'production') { const whyDidYouRender = require('@welldone-software/why-did-you-render'); diff --git a/src/store/index.ts b/src/store/index.ts index 39d64b3b..4b011018 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -511,7 +511,7 @@ export const storeModel: StoreModel = { }), }; -const nodeEnv: string = process.env.NODE_ENV as string; +const nodeEnv: string = __ENV__ as string; const store = createStore(storeModel, { devTools: nodeEnv === 'development' }); export default store;