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

Adding an option to import well-known types from a provided package. #336

Conversation

nicolasalt
Copy link

The user may want to have well-known types in a separate NPM package:

  • These generated files are always the same and may feel like they are polluting the codebase.
  • For Web, if multiple dependencies of a single project use well-known types, they'll be duplicated in the output Web bundle.

Ideally there would be a single NPM package with well-known types, maintained as a part of protobuf-ts, but this PR is an ok workaround for now.

This option is implemented as an environment variable because the options parser only supports boolean values.

@timostamm
Copy link
Owner

Nikolay, I agree that the best way to handle the well-known types is to publish them to a package. This is one of the improvements of protobuf-es. You can still generate them explicitly if you want, but by default, well-known types are imported from a package on npmjs.com. The plan is to switch to the base types provided by protobuf-es (with a small compatibility layer), so we will get that feature for free*.

Apologies for closing this, but I the handling of WKT in protobuf-es already addresses all complications, and we're better off building on top of it instead of duplicating the effort.

  • not actually for free, because a nice migration path is a bunch of work 😄

@timostamm timostamm closed this Aug 17, 2022
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

Successfully merging this pull request may close these issues.

2 participants