mirror of https://github.com/grpc/grpc-node.git
Merge pull request #676 from murgatroid99/proto_loader_resolve_fallback
proto loader: Fall back to default path resolution
This commit is contained in:
commit
a4553f1a69
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue