proto loader: Fall back to default path resolution

This commit is contained in:
murgatroid99 2018-12-07 11:43:02 -08:00
parent db205a82b6
commit a6ecc7c8c8
1 changed files with 2 additions and 1 deletions

View File

@ -118,6 +118,7 @@ function createPackageDefinition(root: Protobuf.Root, options: Options): Package
}
function addIncludePathResolver(root: Protobuf.Root, includePaths: string[]) {
const originalResolvePath = root.resolvePath;
root.resolvePath = (origin: string, target: string) => {
if (path.isAbsolute(target)) {
return target;
@ -131,7 +132,7 @@ function addIncludePathResolver(root: Protobuf.Root, includePaths: string[]) {
continue;
}
}
throw new Error(`Could not find file ${target}`);
return originalResolvePath(origin, target);
};
}