fix imports issue

This commit is contained in:
Iuri Matias 2018-01-12 14:21:36 -05:00
parent 7bd1be0d05
commit 728aea6e04
4 changed files with 18 additions and 4 deletions

View File

@ -173,7 +173,7 @@ class Cmd {
program program
.command('reset') .command('reset')
.description('resets embarks state on this dapp including clearing cache') .description('resets embarks state on this dapp including clearing cache')
.action(function (file) { .action(function () {
embark.initConfig('development', { embark.initConfig('development', {
embarkConfig: 'embark.json', interceptLogs: false embarkConfig: 'embark.json', interceptLogs: false
}); });
@ -181,7 +181,6 @@ class Cmd {
}); });
} }
versionCmd() { versionCmd() {
program program
.command('version') .command('version')

View File

@ -4,7 +4,7 @@ var fs = require('../../core/fs.js');
var GethCommands = require('./geth_commands.js'); var GethCommands = require('./geth_commands.js');
/*eslint complexity: ["error", 25]*/ /*eslint complexity: ["error", 26]*/
var Blockchain = function(options) { var Blockchain = function(options) {
this.blockchainConfig = options.blockchainConfig; this.blockchainConfig = options.blockchainConfig;
this.env = options.env || 'development'; this.env = options.env || 'development';

View File

@ -36,6 +36,7 @@ class Pipeline {
let importsList = {}; let importsList = {};
//importsList["Embark/EmbarkJS"] = fs.embarkPath("js/embark.js"); //importsList["Embark/EmbarkJS"] = fs.embarkPath("js/embark.js");
importsList["Embark/EmbarkJS"] = utils.joinPath(fs.dappPath(), ".embark", 'embark.js'); importsList["Embark/EmbarkJS"] = utils.joinPath(fs.dappPath(), ".embark", 'embark.js');
importsList["Embark/web3"] = utils.joinPath(fs.dappPath(), ".embark", 'web3_instance.js'); importsList["Embark/web3"] = utils.joinPath(fs.dappPath(), ".embark", 'web3_instance.js');
@ -44,7 +45,10 @@ class Pipeline {
importsList[importName] = importLocation; importsList[importName] = importLocation;
}); });
let realCwd;
async.waterfall([ async.waterfall([
function findImports(next) { function findImports(next) {
webpack({ webpack({
entry: utils.joinPath(fs.dappPath(), file.filename), entry: utils.joinPath(fs.dappPath(), file.filename),
@ -72,6 +76,12 @@ class Pipeline {
}); });
}, },
function changeCwd(next) {
realCwd = process.env.PWD;
process.chdir(fs.embarkPath(''));
next();
},
function runWebpack(next) { function runWebpack(next) {
webpack({ webpack({
entry: utils.joinPath(fs.dappPath(), file.filename), entry: utils.joinPath(fs.dappPath(), file.filename),
@ -110,6 +120,11 @@ class Pipeline {
next(); next();
}); });
},
function changeCwdBack(next) {
process.chdir(realCwd);
next();
} }
], function(_err, _result) { ], function(_err, _result) {

View File

@ -51,7 +51,7 @@
"underscore.string": "^3.3.4", "underscore.string": "^3.3.4",
"url-loader": "^0.6.2", "url-loader": "^0.6.2",
"web3": "1.0.0-beta.27", "web3": "1.0.0-beta.27",
"webpack": "^2.6.1", "webpack": "^3.10.0",
"window-size": "^1.1.0" "window-size": "^1.1.0"
}, },
"author": "Iuri Matias <iuri.matias@gmail.com>", "author": "Iuri Matias <iuri.matias@gmail.com>",