fix imports issue

This commit is contained in:
Iuri Matias 2018-02-22 14:56:55 -05:00
parent 9cd8449014
commit 20f4e7621b
2 changed files with 16 additions and 8 deletions

View File

@ -43,12 +43,20 @@ class Pipeline {
importsList["Embark/EmbarkJS"] = utils.joinPath(fs.dappPath(), ".embark", 'embark.js');
importsList["Embark/web3"] = utils.joinPath(fs.dappPath(), ".embark", 'web3_instance.js');
importsList["Embark/contracts/SimpleStorage"] = utils.joinPath(fs.dappPath(), ".embark", 'SimpleStorage.js');
self.plugins.getPluginsProperty('imports', 'imports').forEach(function (importObject) {
let [importName, importLocation] = importObject;
importsList[importName] = importLocation;
});
for (let contractName in contractsJSON) {
let contractCode = self.buildContractJS(contractName);
let filePath = utils.joinPath(fs.dappPath(), ".embark", contractName + '.js');
fs.writeFileSync(filePath, contractCode);
importsList["Embark/contracts/" + contractName] = filePath;
}
let realCwd;
async.waterfall([
@ -69,13 +77,13 @@ class Pipeline {
if (request === utils.joinPath(fs.dappPath(), file.filename)) {
callback();
} else {
if (request.indexOf('Embark/contracts/') === 0) {
let contractName = request.split('/')[2];
let contractCode = self.buildContractJS(contractName);
let filePath = utils.joinPath(fs.dappPath(), ".embark", contractName + '.js');
fs.writeFileSync(filePath, contractCode);
importsList[request] = filePath;
}
//if (request.indexOf('Embark/contracts/') === 0) {
// let contractName = request.split('/')[2];
// let contractCode = self.buildContractJS(contractName);
// let filePath = utils.joinPath(fs.dappPath(), ".embark", contractName + '.js');
// fs.writeFileSync(filePath, contractCode);
// importsList[request] = filePath;
//}
callback(null, "amd " + Math.random());
}
}

View File

@ -2,7 +2,7 @@
import React, { Component } from 'react';
import EmbarkJS from 'Embark/EmbarkJS';
import SimpleStorage from 'Embark/contracts/SimpleStorage';
//import SimpleStorage from 'Embark/contracts/SimpleStorage';
import Test from 'Embark/contracts/Test';
import Assert from 'Embark/contracts/Assert';