Skip to content

Commit

Permalink
fix(common): always import relative sol files from ./ (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Sep 24, 2023
1 parent 44a5432 commit 0b8ce3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fresh-scissors-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/common": patch
---

Minor fix to resolving user types: `solc` doesn't like relative imports without `./`, but is fine with relative imports from `./../`, so we always append `./` to the relative path.
3 changes: 2 additions & 1 deletion packages/common/src/codegen/utils/loadUserTypesFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ function loadUserTypesFile(
data: string;
} {
if (unresolvedFilePath.at(0) === ".") {
const relativePath = path.relative(outputBaseDirectory, unresolvedFilePath);
return {
filePath: path.relative(outputBaseDirectory, unresolvedFilePath),
filePath: "./" + relativePath, // solc doesn't like relative paths without "./"
data: readFileSync(unresolvedFilePath, "utf8"),
};
} else {
Expand Down

0 comments on commit 0b8ce3f

Please sign in to comment.