Skip to content

Commit 22386e6

Browse files
committed
merge current build context environment vars for lambda build
1 parent 714ace4 commit 22386e6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/build.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ function getBabelTarget(envConfig) {
1616
function webpackConfig(dir, additionalConfig) {
1717
var config = conf.load();
1818
var envConfig = config.build.environment || config.build.Environment || {};
19+
var context = (
20+
process.env.CONTEXT &&
21+
config.context &&
22+
config.context[process.env.CONTEXT] &&
23+
(config.context[process.env.CONTEXT].environment || config.context[process.env.CONTEXT].Environment)
24+
) || {};
25+
Object.keys(context).forEach(key => {
26+
envConfig[key] = context[key];
27+
});
1928
var babelOpts = { cacheDirectory: true };
2029
if (!fs.existsSync(path.join(process.cwd(), ".babelrc"))) {
2130
babelOpts.presets = [

0 commit comments

Comments
 (0)