diff --git a/.babelrc b/.babelrc index 12321ba370..3a9f24e750 100644 --- a/.babelrc +++ b/.babelrc @@ -1,6 +1,12 @@ { "presets": [ - ["env", { "targets": { "node": "7.9.0", "electron": "1.7.8" }, "useBuiltIns": true }], + [ + "env", + { + "targets": { "node": "7.9.0", "electron": "1.7.8" }, + "useBuiltIns": true + } + ], "stage-0", "react" ], @@ -9,30 +15,49 @@ "env": { "production": { "presets": ["react-optimize"], - "plugins": ["babel-plugin-dev-expression", "transform-class-properties", "transform-es2015-classes"] + "plugins": [ + "babel-plugin-dev-expression", + "transform-class-properties", + "transform-es2015-classes" + ] }, "development": { "plugins": [ "transform-class-properties", - "transform-es2015-classes" + "transform-es2015-classes", + [ + "transform-define", + { + "__VERSION_SHA__": "abcd" + } + ] ], "presets": ["react-hmre"] }, "test": { "plugins": [ - [ "module-resolver", { - "root": ["./app/node_modules"], - "alias": { - "node-hid": "./app/node_modules/node-hid", - "serialport": "./app/node_modules/serialport" + [ + "module-resolver", + { + "root": ["./app/node_modules"], + "alias": { + "node-hid": "./app/node_modules/node-hid", + "serialport": "./app/node_modules/serialport" + } } - } ], - ["webpack-loaders", { "config": "webpack.config.test.js", "verbose": false }], + ], + [ + "webpack-loaders", + { "config": "webpack.config.test.js", "verbose": false } + ], "babel-plugin-rewire", - ["transform-define", { - "__VERSION_SHA__": "abcd", - "process.env.DEBUG_ERROR": false - }] + [ + "transform-define", + { + "__VERSION_SHA__": "abcd", + "process.env.DEBUG_ERROR": false + } + ] ] } } diff --git a/app/utils/rollbar.js b/app/utils/rollbar.js index e2a2b6d954..0d9b3f4c54 100644 --- a/app/utils/rollbar.js +++ b/app/utils/rollbar.js @@ -1,34 +1,38 @@ /* global __VERSION_SHA__ */ - import Rollbar from 'rollbar/dist/rollbar.umd'; -let rollbar = new Rollbar({ - accessToken: '1843589282464f4facd43f794c8201a8', - captureUncaught: true, - enabled: process.env.NODE_ENV === 'production', - payload: { - environment: 'electron_renderer', - client: { - javascript: { - code_version: __VERSION_SHA__, - guess_uncaught_frames: true +let rollbar; + +if (process.env.NODE_ENV === 'production') { + + rollbar = new Rollbar({ + accessToken: '1843589282464f4facd43f794c8201a8', + captureUncaught: true, + enabled: process.env.NODE_ENV === 'production', + payload: { + environment: 'electron_renderer', + client: { + javascript: { + code_version: __VERSION_SHA__, + guess_uncaught_frames: true + } } - } - }, - // to deal with URI's as local filesystem paths, we use the "many domain" transform: - // https://rollbar.com/docs/source-maps/#using-source-maps-on-many-domains - transform: function(payload) { - var trace = payload.body.trace; - if (trace && trace.frames) { - for (var i = 0; i < trace.frames.length; i++) { - var filename = trace.frames[i].filename; - if (filename) { - trace.frames[i].filename = 'http://dynamichost/dist/bundle.js'; + }, + // to deal with URI's as local filesystem paths, we use the "many domain" transform: + // https://rollbar.com/docs/source-maps/#using-source-maps-on-many-domains + transform: function(payload) { + var trace = payload.body.trace; + if (trace && trace.frames) { + for (var i = 0; i < trace.frames.length; i++) { + var filename = trace.frames[i].filename; + if (filename) { + trace.frames[i].filename = 'http://dynamichost/dist/bundle.js'; + } } } } } - } -); + ); +}; export default rollbar;