fix(env): Use NODE_ENV to enable/disable opbeat frontend
parent
fa59bcfd7b
commit
73b8ba96af
|
@ -1,4 +1,3 @@
|
||||||
/* global __OPBEAT__ORG_ID __OPBEAT__APP_ID */
|
|
||||||
import initOpbeat from 'opbeat-react';
|
import initOpbeat from 'opbeat-react';
|
||||||
import { createOpbeatMiddleware } from 'opbeat-react/redux';
|
import { createOpbeatMiddleware } from 'opbeat-react/redux';
|
||||||
import Rx from 'rx';
|
import Rx from 'rx';
|
||||||
|
@ -20,8 +19,13 @@ import {
|
||||||
saveToColdStorage
|
saveToColdStorage
|
||||||
} from './cold-reload';
|
} from './cold-reload';
|
||||||
|
|
||||||
const localhostRE = /^(localhost|127.|0.)/;
|
const {
|
||||||
const enableOpbeat = !localhostRE.test(window.location.hostname);
|
__OPBEAT__ORG_ID,
|
||||||
|
__OPBEAT__APP_ID,
|
||||||
|
NODE_ENV
|
||||||
|
} = process.env;
|
||||||
|
|
||||||
|
const enableOpbeat = NODE_ENV !== 'development';
|
||||||
|
|
||||||
if (enableOpbeat) {
|
if (enableOpbeat) {
|
||||||
if (!__OPBEAT__ORG_ID || !__OPBEAT__APP_ID) {
|
if (!__OPBEAT__ORG_ID || !__OPBEAT__APP_ID) {
|
||||||
|
|
|
@ -53,11 +53,11 @@ module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
NODE_ENV: JSON.stringify(__DEV__ ? 'development' : 'production')
|
NODE_ENV: JSON.stringify(__DEV__ ? 'development' : 'production'),
|
||||||
|
__OPBEAT__ORG_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_ORG_ID),
|
||||||
|
__OPBEAT__APP_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_APP_ID)
|
||||||
},
|
},
|
||||||
__DEVTOOLS__: !__DEV__,
|
__DEVTOOLS__: !__DEV__
|
||||||
__OPBEAT__ORG_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_ORG_ID),
|
|
||||||
__OPBEAT__APP_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_APP_ID)
|
|
||||||
}),
|
}),
|
||||||
// Use browser version of visionmedia-debug
|
// Use browser version of visionmedia-debug
|
||||||
new webpack.NormalModuleReplacementPlugin(
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
|
|
Loading…
Reference in New Issue