aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-12-04 20:53:15 +0800
committerGitHub <noreply@github.com>2018-12-04 20:53:15 +0800
commit79f5e36edbd8a4483aac46032092dece95bb0b4c (patch)
treeb9c86a0badb2f1e82efa6354eede587368449a87 /packages/sol-compiler/src
parenta1e985a1cac46ecbc54c7ef5b846fb5faf2bede2 (diff)
parenta87276341356e31e0712f42ada00ed5d55707a6b (diff)
downloaddexon-sol-tools-79f5e36edbd8a4483aac46032092dece95bb0b4c.tar
dexon-sol-tools-79f5e36edbd8a4483aac46032092dece95bb0b4c.tar.gz
dexon-sol-tools-79f5e36edbd8a4483aac46032092dece95bb0b4c.tar.bz2
dexon-sol-tools-79f5e36edbd8a4483aac46032092dece95bb0b4c.tar.lz
dexon-sol-tools-79f5e36edbd8a4483aac46032092dece95bb0b4c.tar.xz
dexon-sol-tools-79f5e36edbd8a4483aac46032092dece95bb0b4c.tar.zst
dexon-sol-tools-79f5e36edbd8a4483aac46032092dece95bb0b4c.zip
Merge pull request #1311 from 0xProject/feature/contracts-monorepo-2
Contracts monorepo II
Diffstat (limited to 'packages/sol-compiler/src')
-rw-r--r--packages/sol-compiler/src/compiler.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 8ee7fa4a9..cba67f292 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -394,7 +394,14 @@ export class Compiler {
//
const lastPathSeparatorPos = contractPath.lastIndexOf('/');
const contractFolder = lastPathSeparatorPos === -1 ? '' : contractPath.slice(0, lastPathSeparatorPos + 1);
- importPath = path.resolve('/' + contractFolder, importPath).replace('/', '');
+ if (importPath.startsWith('.')) {
+ /**
+ * Some imports path are relative ("../Token.sol", "./Wallet.sol")
+ * while others are absolute ("Token.sol", "@0x/contracts/Wallet.sol")
+ * And we need to append the base path for relative imports.
+ */
+ importPath = path.resolve('/' + contractFolder, importPath).replace('/', '');
+ }
if (_.isUndefined(sourcesToAppendTo[importPath])) {
sourcesToAppendTo[importPath] = { id: fullSources[importPath].id };