aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-21 05:14:20 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-21 05:14:20 +0800
commit748e3c0c5358b99f15baf4bf95da027c9b83eb89 (patch)
tree229dac31fdcf95bfcf94274d3e13ca5c2185de6c /packages/instant
parent728617fed2fee99b2accdcf6d2ddc9036c9ad266 (diff)
downloaddexon-sol-tools-748e3c0c5358b99f15baf4bf95da027c9b83eb89.tar
dexon-sol-tools-748e3c0c5358b99f15baf4bf95da027c9b83eb89.tar.gz
dexon-sol-tools-748e3c0c5358b99f15baf4bf95da027c9b83eb89.tar.bz2
dexon-sol-tools-748e3c0c5358b99f15baf4bf95da027c9b83eb89.tar.lz
dexon-sol-tools-748e3c0c5358b99f15baf4bf95da027c9b83eb89.tar.xz
dexon-sol-tools-748e3c0c5358b99f15baf4bf95da027c9b83eb89.tar.zst
dexon-sol-tools-748e3c0c5358b99f15baf4bf95da027c9b83eb89.zip
Force source maps on staging and dogfood
Diffstat (limited to 'packages/instant')
-rw-r--r--packages/instant/webpack.config.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js
index e472824f5..e3ba59eb3 100644
--- a/packages/instant/webpack.config.js
+++ b/packages/instant/webpack.config.js
@@ -35,12 +35,14 @@ const getHeapAnalyticsId = environmentName => {
return undefined;
};
+const ROLLBAR_PUBLISH_TOKEN_ENV_NAME = 'INSTANT_ROLLBAR_PUBLISH_TOKEN';
+const ROLLBAR_CLIENT_TOKEN_ENV_NAME = 'INSTANT_ROLLBAR_CLIENT_TOKEN';
const getRollbarPlugin = environmentName => {
if (!environmentName) {
return undefined;
}
- const publishToken = process.env.INSTANT_ROLLBAR_PUBLISH_TOKEN;
+ const publishToken = process.env[ROLLBAR_PUBLISH_TOKEN_ENV_NAME];
if (!publishToken) {
return undefined;
}
@@ -65,6 +67,26 @@ const getRollbarPlugin = environmentName => {
return new RollbarSourceMapPlugin(rollbarPluginOptions);
};
+const validateRollbar = (environmentName, rollbarPlugin) => {
+ const requiresRollbar = environmentName === 'dogfood' || environmentName === 'staging';
+
+ if (!requiresRollbar) {
+ return;
+ }
+
+ if (!process.env[ROLLBAR_CLIENT_TOKEN_ENV_NAME]) {
+ throw new Error(`${ROLLBAR_CLIENT_TOKEN_ENV_NAME} must be set for ${environmentName}`);
+ }
+
+ if (!rollbarPlugin) {
+ if (environmentName === 'dogfood' || environmentName === 'staging') {
+ throw new Error(
+ `Please set rollbar env var ${ROLLBAR_PUBLISH_TOKEN_ENV_NAME} to a Rollbar project access token with post_server_item permissions to deploy source maps to ${environmentName}`,
+ );
+ }
+ }
+};
+
module.exports = (env, argv) => {
const environmentName = getEnvironmentName(env, argv);
const outputPath = process.env.WEBPACK_OUTPUT_PATH || 'umd';
@@ -76,11 +98,12 @@ module.exports = (env, argv) => {
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.INSTANT_ROLLBAR_CLIENT_TOKEN),
+ 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),
},
}),
];
+
const rollbarPlugin = getRollbarPlugin(environmentName);
if (rollbarPlugin) {
console.log('Using rollbar plugin');
@@ -88,6 +111,7 @@ module.exports = (env, argv) => {
} else {
console.log('Not using rollbar plugin');
}
+ validateRollbar(environmentName, rollbarPlugin);
const config = {
entry: {