grpc/grpc-node

@grpc/reflection Not working after bundling

polRk opened this issue · 1 comments

polRk commented

Problem description

  1. The package should not import anything from runtime from the file system. after assembling the application into a single js bundle, there are neither the correct paths nor the files themselves. And this is a very big problem, because no one thinks about it
const protoPath = path.join(__dirname, '../../proto/grpc/reflection/v1/reflection.proto');
const pkgDefinition = protoLoader.loadSync(protoPath, constants_1.PROTO_LOADER_OPTS);
  1. Provide esm bundle, because __dirname is undefined

Reproduction steps

just bundle any application into single js file and remove node_modules folder.

Environment

  • OS name, version and architecture: [e.g. Linux Ubuntu 18.04 amd64]
  • Node version [e.g. 8.10.0]
  • Node installation method [e.g. nvm]
  • If applicable, compiler version [e.g. clang 3.8.0-2ubuntu4]
  • Package name and version [e.g. gRPC@1.12.0]

Additional context

Add any other context about the problem here. If possible, attach full logs. Do not try to omit anything for brevity, but instead include absolutely everything. Please try and set your operating system's locale to English, so that logs contain error messages in the English language.

Currently, supporting bundling is not a design goal of these libraries, so I do not intend to try to fix this.