improbable-eng / ts-protoc-gen

Protocol Buffers Compiler (protoc) plugin for TypeScript and gRPC-Web.
Apache License 2.0
1.36k stars 173 forks source link

added import_style parameter to generate import statements for browser that support es6 #306

Open safanaj opened 2 years ago

safanaj commented 2 years ago

Changes

I need this to use protoc-gen-ts to generate service js file usable in sveltejs + vitejs (rollup bundler).

Passing the import_style param like --ts_out=service=grpc-web,import_style=es6 the require(...) statements are replaced by import * as ... from ... statements, and exports. .... = ... by export {...} statements.

Verification

I checked it with a tiny sveltjs+vitejs application.

improbable-prow-robot commented 2 years ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please assign marcuslongmuir You can assign the PR to them by writing /assign @marcuslongmuir in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/improbable-eng/ts-protoc-gen/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
safanaj commented 2 years ago

/assign @marcuslongmuir