diff --git a/.changeset/fresh-scissors-unite.md b/.changeset/fresh-scissors-unite.md new file mode 100644 index 0000000000..bc4cc8fe8b --- /dev/null +++ b/.changeset/fresh-scissors-unite.md @@ -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. diff --git a/packages/common/src/codegen/utils/loadUserTypesFile.ts b/packages/common/src/codegen/utils/loadUserTypesFile.ts index 2a5394e483..8573e8c165 100644 --- a/packages/common/src/codegen/utils/loadUserTypesFile.ts +++ b/packages/common/src/codegen/utils/loadUserTypesFile.ts @@ -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 {