adding function to check node_env (#414)
This commit is contained in:
parent
54216ae3d0
commit
fe6d3e3228
@ -10,7 +10,8 @@ import Home from '@containers/home';
|
||||
import NotFound from '@containers/not-found';
|
||||
import Nav from '@components/navigation';
|
||||
import OrgNavigation from '@components/navigation/org';
|
||||
import PerfProfiler from '../perf-profiler';
|
||||
import { isProduction } from '@utils';
|
||||
import PerfProfiler from '@perf-profiler';
|
||||
import React from 'react';
|
||||
|
||||
const App = connect()(React.createClass({
|
||||
@ -33,7 +34,7 @@ const App = connect()(React.createClass({
|
||||
return _children;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && process.env.BASELINE_GRID) {
|
||||
if ( !isProduction() && process.env.BASELINE_GRID) {
|
||||
_children = (
|
||||
<BaselineGrid>
|
||||
{_children}
|
||||
@ -51,7 +52,7 @@ const App = connect()(React.createClass({
|
||||
|
||||
export default (props) => (
|
||||
<div>
|
||||
{ process.env.NODE_ENV !== 'production' && <PerfProfiler /> }
|
||||
{ !isProduction() && <PerfProfiler /> }
|
||||
|
||||
<App {...props}>
|
||||
<Header />
|
||||
|
@ -13,8 +13,9 @@ import MockState from '@mock-states';
|
||||
import LeakDatasets from './dataset-leak.json';
|
||||
import NormalDatasets from './dataset-normal.json';
|
||||
import Store from '@state/store';
|
||||
import { isProduction } from '@utils';
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if ( !isProduction() ) {
|
||||
a11y(React, {
|
||||
ReactDOM
|
||||
});
|
||||
|
@ -12,6 +12,7 @@ const Profiler = styled.div`
|
||||
background: #bada55;
|
||||
border: 2px solid black;
|
||||
text-align: center;
|
||||
z-index: 1;
|
||||
|
||||
& > h1 {
|
||||
font-size: 1.5em;
|
||||
|
@ -6,6 +6,7 @@ import thunk from 'redux-thunk';
|
||||
import perflogger from 'redux-perf-middleware';
|
||||
|
||||
import createReducer from '@state/reducers';
|
||||
import { isProduction } from '@utils';
|
||||
|
||||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||
|
||||
@ -18,7 +19,7 @@ export default (state = Object.freeze({})) => {
|
||||
createLogger(),
|
||||
promiseMiddleware(),
|
||||
thunk,
|
||||
process.env.NODE_ENV !== 'production' && perflogger
|
||||
!isProduction() && perflogger
|
||||
)
|
||||
)
|
||||
);
|
||||
|
1
frontend/src/utils/index.js
Normal file
1
frontend/src/utils/index.js
Normal file
@ -0,0 +1 @@
|
||||
export const isProduction = () => process.env.NODE_ENV === 'production';
|
@ -9,8 +9,7 @@ const {
|
||||
MODULES,
|
||||
FRONTEND,
|
||||
UI,
|
||||
STATIC,
|
||||
MOCKSTATE
|
||||
STATIC
|
||||
} = paths;
|
||||
|
||||
module.exports = {
|
||||
@ -25,8 +24,7 @@ module.exports = {
|
||||
[`@${path.basename(fullpath)}`]: fullpath
|
||||
}), {
|
||||
'@root': FRONTEND,
|
||||
'@ui': UI,
|
||||
'@mock-states': MOCKSTATE
|
||||
'@ui': UI
|
||||
})
|
||||
},
|
||||
resolveLoader: {
|
||||
|
@ -14,7 +14,6 @@ module.exports = {
|
||||
'node_modules'
|
||||
],
|
||||
FRONTEND: path.join(FRONTEND, 'src'),
|
||||
MOCKSTATE: path.join(FRONTEND, 'src/mock-states'),
|
||||
UI: process.env.NODE_ENV === 'production'
|
||||
? path.join(FRONTEND, 'node_modules', '@tomgco/joyent-portal-ui', 'dist')
|
||||
: path.join(UI, 'src'),
|
||||
|
Loading…
Reference in New Issue
Block a user