diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index e5c24be7..d2c9a080 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -23,8 +23,11 @@ class Pipeline { this.buildContracts(contractsJSON); + + self.buildWeb3JS(function() { + // limit:1 due to issues when downloading required files such as web3.js - async.eachOfLimit(this.assetFiles, 1, function (files, targetFile, cb) { + async.eachOfLimit(self.assetFiles, 1, function (files, targetFile, cb) { // limit:1 due to issues when downloading required files such as web3.js async.mapLimit(files, 1, function(file, fileCb) { @@ -34,6 +37,7 @@ class Pipeline { let importsList = {}; importsList["Embark/EmbarkJS"] = fs.embarkPath("js/embark.js"); + importsList["Embark/web3"] = utils.joinPath(fs.dappPath(), ".embark", 'web3_instance.js'); async.waterfall([ function findImports(next) { @@ -55,11 +59,6 @@ class Pipeline { let filePath = utils.joinPath(fs.dappPath(), ".embark", contractName + '.js'); fs.writeFileSync(filePath, contractCode); importsList[request] = filePath; - } else if (request === "Embark/web3") { - return self.buildWeb3JS(function() { - importsList[request] = utils.joinPath(fs.dappPath(), ".embark", 'web3_instance.js'); - callback(null, "amd " + Math.random()); - }); } callback(null, "amd " + Math.random()); } @@ -164,6 +163,7 @@ class Pipeline { function (_err, _results) { callback(); }); + }); } build2(abi, contractsJSON, path, callback) { @@ -455,6 +455,7 @@ class Pipeline { code += "\nwindow.web3 = web3;\n"; code += "\nexport default web3;\n"; let filePath = utils.joinPath(fs.dappPath(), ".embark", 'web3_instance.js'); + fs.mkdirpSync(utils.joinPath(fs.dappPath(), ".embark")); fs.writeFileSync(filePath, code); cb(); }); diff --git a/test_app/app/js/new_index.js b/test_app/app/js/new_index.js index 6d8e70ca..9203ca53 100644 --- a/test_app/app/js/new_index.js +++ b/test_app/app/js/new_index.js @@ -8,12 +8,12 @@ import $ from './_vendor/jquery.min'; //console.log("finished importing web3"); import EmbarkJS from 'Embark/EmbarkJS'; import SimpleStorage from 'Embark/contracts/SimpleStorage'; -import web3 from 'Embark/web3'; +//import web3 from 'Embark/web3'; console.log("SimpleStorage") console.log(SimpleStorage); -console.log(EmbarkJS); +//console.log(EmbarkJS); window.SimpleStorage = SimpleStorage; import test3 from './foo';