diff --git a/lib/modules/code_generator/code_templates/do-when-loaded.js.ejs b/lib/modules/code_generator/code_templates/do-when-loaded.js.ejs index f07211592..5503ad3cd 100644 --- a/lib/modules/code_generator/code_templates/do-when-loaded.js.ejs +++ b/lib/modules/code_generator/code_templates/do-when-loaded.js.ejs @@ -1,5 +1,7 @@ whenEnvIsLoaded(function(){ - <%- block %> + __mainContext.__loadManagerInstance.doFirst(function(done) { + <%- block %> + }); if (EmbarkJS) { EmbarkJS.environment = "<%- environment %>"; diff --git a/lib/modules/code_generator/index.js b/lib/modules/code_generator/index.js index 1a532194e..c903da695 100644 --- a/lib/modules/code_generator/index.js +++ b/lib/modules/code_generator/index.js @@ -103,12 +103,12 @@ class CodeGenerator { }); } - generateContext() { - let result = ""; - result += Templates.main_context(); - result += Templates.load_manager(); - return result; - } + //generateContext() { + // let result = ""; + // result += Templates.main_context(); + // result += Templates.load_manager(); + // return result; + //} generateProvider(isDeployment) { let self = this; @@ -386,7 +386,7 @@ class CodeGenerator { let providerCode = self.generateProvider(false); code += providerCode; - code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n"; + //code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n"; code += "\nexport default web3;\n"; next(null, code); }