normalise import path in generated code
Author: danieleadesCreated Sep 11, 2020Updated Jun 19, 2026
I have a project where the script running the code generation is a few levels deeper in the filesystem than the proto files that are being generated.
I end up with imports that look something like
import * as ${PACKAGE} from '../../../../../some/very/long/file/path/${SERVICE}_pb';
which can be normalised to
import * as ${PACKAGE} from './${SERVICE}_pb';
This would cause issues if my project was close enough to /root that the path becomes invalid
What can I do about this?
Source: grpc/grpc-web