Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --no-bundle option for static code generation #1249

Open
taylorcode opened this issue Jun 14, 2019 · 0 comments
Open

add --no-bundle option for static code generation #1249

taylorcode opened this issue Jun 14, 2019 · 0 comments

Comments

@taylorcode
Copy link
Collaborator

protobuf.js version: 6.8.8

Using pbjs with the static-module target produces a single JS bundle that contains the code for all transitively imported packages. I don't see an option to disable this behavior?

This is not ideal even for browser use cases, because any packages that are imported in multiple .proto files will appear in the bundles redundantly.

It also looks like they will clobber themselves at runtime, since the packages are attached to to $protobuf.roots["default"], e.g. $root.awesomepackage = (() => {. Any references to $root.awesomepackage would be destroyed once the code was redundantly loaded.

If bundling is desired, a tool such as rollup or webpack can be used by the consumer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant