From bfbfcc04bd42ed4077586157d042bcd2d7e00475 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Tue, 27 Mar 2018 16:54:17 -0700 Subject: [PATCH] Introduce feature flag component Co-authored-by: Andrew Watkins Co-authored-by: Brandon Farmer --- ui/src/shared/components/FeatureFlag.tsx | 15 +++++++++++++++ ui/webpack/dev.config.js | 3 +++ 2 files changed, 18 insertions(+) create mode 100644 ui/src/shared/components/FeatureFlag.tsx diff --git a/ui/src/shared/components/FeatureFlag.tsx b/ui/src/shared/components/FeatureFlag.tsx new file mode 100644 index 0000000000..ac63488a59 --- /dev/null +++ b/ui/src/shared/components/FeatureFlag.tsx @@ -0,0 +1,15 @@ +import {SFC} from 'react' + +interface Props { + children?: any +} + +const FeatureFlag: SFC = props => { + if (process.env.NODE_ENV === 'development') { + return props.children + } + + return null +} + +export default FeatureFlag diff --git a/ui/webpack/dev.config.js b/ui/webpack/dev.config.js index b4c57df65c..7fc3b64650 100644 --- a/ui/webpack/dev.config.js +++ b/ui/webpack/dev.config.js @@ -145,6 +145,9 @@ module.exports = { ], }, plugins: [ + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('development'), + }), new webpack.DllReferencePlugin({ context: process.cwd(), manifest: require('../build/vendor.dll.json'),