![]() I see that they wrote their own protoc plugin, which I'm guessing is the key to this issue. I'm only waiting on them to add node.js support after which this grpc-web repo may as well be deprecated as far as I am concerned. Regardless of that, it looks like someone finally figured out how to do grpc in the browser correctly: It doesn't appear that using that package.json property does anything here, so I'm not sure exactly why tree shaking is not working. The typical culprit is forgetting to add sideEffects: false to the package.json which is a signal to webpack that the package doesn't do some crazy things like dynamically importing using variables which makes it difficult to figure out precisely which parts may be tree shaken out or not. This tells me that tree shaking is somehow broken here. Yet the entirety of google-protobuf is pulled into the bundle that we're all experiencing here. In theory here, webpack should tree shake away the unused parts of google-protobuf as there's no way that those two functions require the vast functionality that is provided by that package. The generated code contains only two references to google-protobuf which are goog.exportSymbol() and () as mentioned above. In my project, I have a very simple case which imports the generated enums that were generated from some very simple protos (no service definitions). I see you ran the webpack-bundle-analyzer above which is what I've been running too on my project. You may not have understood what I meant. If you are aware of any kind of static analysis that would show the percentage of the library we should in fact pull in, it would be helpful :) ![]() I'm curious what's the reason you think the dependency we have pulled in is a tiny part of the library, and should not in turn pull in the majority of the protobuf library? What seems very odd to me, is that the entire google-protobuf is being pulled in even if only a tiny part of the library was actually used.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |