From 21cb49c80ce6dfdc0e6158d01e4f892c7b1b2cc5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 28 May 2018 18:11:47 +0200 Subject: [PATCH] import event when url is "deconcatened" with 'contracts' keyword --- src/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 4ed608a9f4..f970ddb079 100644 --- a/src/app.js +++ b/src/app.js @@ -263,9 +263,12 @@ Please make a backup of your contracts and start using http://remix.ethereum.org }) } else if (self._components.compilerImport.isRelativeImport(url)) { // try to resolve localhost modules (aka truffle imports) + var splitted = /([^/]+)\/(.*)$/g.exec(url) async.tryEach([ (cb) => { importFileCb('localhost/installed_contracts/' + url, cb) }, - (cb) => { importFileCb('localhost/nodes_modules/' + url, cb) }], + (cb) => { if (!splitted) { cb('url not parseable' + url) } else { importFileCb('localhost/installed_contracts/' + splitted[1] + '/contracts/' + splitted[2], cb) } }, + (cb) => { importFileCb('localhost/node_modules/' + url, cb) }, + (cb) => { if (!splitted) { cb('url not parseable' + url) } else { importFileCb('localhost/node_modules/' + splitted[1] + '/contracts/' + splitted[2], cb) } }], (error, result) => { filecb(error, result) } ) } else {