diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-22 02:25:10 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-22 02:25:10 +0800 |
commit | e2a16f3f336c6787501c6a2366e7793a135009f8 (patch) | |
tree | a4ecb9d821cbb986a425136f3a2ead3ee4acfd85 /packages/instant/webpack.config.js | |
parent | 70c99082496bbaed5b5ccc37bb259c0a9f02fab5 (diff) | |
download | dexon-0x-contracts-e2a16f3f336c6787501c6a2366e7793a135009f8.tar.gz dexon-0x-contracts-e2a16f3f336c6787501c6a2366e7793a135009f8.tar.zst dexon-0x-contracts-e2a16f3f336c6787501c6a2366e7793a135009f8.zip |
Use ROLLBAR_ENABLED constant, and change ROLLBAR_ENVIRONMENT to INSTANT_ENVIRONMENT
Diffstat (limited to 'packages/instant/webpack.config.js')
-rw-r--r-- | packages/instant/webpack.config.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js index b08fabedf..defdde250 100644 --- a/packages/instant/webpack.config.js +++ b/packages/instant/webpack.config.js @@ -89,25 +89,31 @@ module.exports = (env, argv) => { const environmentName = getEnvironmentName(env, argv); const outputPath = process.env.WEBPACK_OUTPUT_PATH || 'umd'; + const envVars = { + GIT_SHA: JSON.stringify(GIT_SHA), + NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version), + HEAP_ANALYTICS_ID: getHeapAnalyticsId(environmentName), + INSTANT_ENVIRONMENT: JSON.stringify(environmentName), + ROLLBAR_CLIENT_TOKEN: JSON.stringify(process.env[ROLLBAR_CLIENT_TOKEN_ENV_NAME]), + }; + + const canRollbarBeEnabled = + environmentName === 'development' ? process.env.INSTANT_ROLLBAR_FORCE_DEVELOPMENT_REPORT : true; + if (envVars.INSTANT_ENVIRONMENT && envVars.ROLLBAR_CLIENT_TOKEN && canRollbarBeEnabled) { + envVars['ROLLBAR_ENABLED'] = JSON.stringify(true); + } + let plugins = [ new webpack.DefinePlugin({ - 'process.env': { - GIT_SHA: JSON.stringify(GIT_SHA), - NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version), - HEAP_ANALYTICS_ID: getHeapAnalyticsId(environmentName), - ROLLBAR_ENVIRONMENT: JSON.stringify(environmentName), - ROLLBAR_CLIENT_TOKEN: JSON.stringify(process.env[ROLLBAR_CLIENT_TOKEN_ENV_NAME]), - ROLLBAR_FORCE_DEVELOPMENT_REPORT: JSON.stringify(process.env.INSTANT_ROLLBAR_FORCE_DEVELOPMENT_REPORT), - }, + 'process.env': envVars, }), ]; - const rollbarPlugin = getRollbarPlugin(environmentName); if (rollbarPlugin) { - console.log('Using rollbar plugin'); + console.log('Using rollbar source map plugin'); plugins = plugins.concat(rollbarPlugin); } else { - console.log('Not using rollbar plugin'); + console.log('Not using rollbar source map plugin'); } validateRollbarPresence(environmentName, rollbarPlugin); |