diff --git a/lib/contracts/code_generator.js b/lib/contracts/code_generator.js index 3dcf2cd2..71920502 100644 --- a/lib/contracts/code_generator.js +++ b/lib/contracts/code_generator.js @@ -139,7 +139,7 @@ class CodeGenerator { web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done(err);', warnAboutMetamask: isDev}); } - result += Templates.do_when_loaded({block: web3Load}); + result += Templates.do_when_loaded({block: web3Load, environment: this.env}); } return result; diff --git a/lib/contracts/code_templates/do-when-loaded.js.ejs b/lib/contracts/code_templates/do-when-loaded.js.ejs index 7a984f07..b0d1d73d 100644 --- a/lib/contracts/code_templates/do-when-loaded.js.ejs +++ b/lib/contracts/code_templates/do-when-loaded.js.ejs @@ -1,6 +1,8 @@ whenEnvIsLoaded(function(){ __mainContext.__loadManagerInstance.doFirst(function(done) { <%- block %> - }) + }); + + EmbarkJS.environment = "<%- environment %>"; });