Add infura project id via env variables when bundling instant

This commit is contained in:
Brandon Millman
2019-03-26 14:17:07 -07:00
parent 28c4ca73ab
commit c750368a3e
3 changed files with 35 additions and 19 deletions

View File

@@ -89,11 +89,17 @@ const generateConfig = (dischargeTarget, heapConfigOptions, rollbarConfigOptions
});
}
const infuraProjectId =
dischargeTarget === 'production'
? process.env.INSTANT_INFURA_PROJECT_ID_PRODUCTION
: process.env.INSTANT_INFURA_PROJECT_ID_DEVELOPMENT;
const envVars = {
GIT_SHA: JSON.stringify(GIT_SHA),
NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
ROLLBAR_ENABLED: rollbarEnabled,
HEAP_ENABLED: heapEnabled
HEAP_ENABLED: heapEnabled,
INSTANT_INFURA_PROJECT_ID: JSON.stringify(infuraProjectId),
};
if (dischargeTarget) {
envVars.INSTANT_DISCHARGE_TARGET = JSON.stringify(dischargeTarget);
@@ -141,24 +147,32 @@ const generateConfig = (dischargeTarget, heapConfigOptions, rollbarConfigOptions
},
{
test: /\.js$/,
use: [{
loader: 'babel-loader',
options: {
"plugins": ["transform-runtime"],
'presets': [
['env', {
'targets': {
"chrome": 41
},
}],
],
use: [
{
loader: 'babel-loader',
options: {
plugins: ['transform-runtime'],
presets: [
[
'env',
{
targets: {
chrome: 41,
},
},
],
],
},
},
}, {
loader: 'source-map-loader',
}],
{
loader: 'source-map-loader',
},
],
exclude: function(modulePath) {
return /node_modules/.test(modulePath) &&
/node_modules\/(core-js|lodash|react|websocket)/.test(modulePath);
return (
/node_modules/.test(modulePath) &&
/node_modules\/(core-js|lodash|react|websocket)/.test(modulePath)
);
},
},
],