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 module param to bazel rules for specifying amd or commonjs #179

Closed

Conversation

kellycampbell
Copy link

Changes

  • add option to bazel typescript_proto_library to leave the generated code in commonjs format for nodejs use

Verification

@kellycampbell
Copy link
Author

Fixes #177

@jonny-improbable
Copy link
Contributor

@Dig-Doug, could you please take a look?

@Dig-Doug
Copy link
Contributor

@kellycampbell, thanks for the PR.

I originally considered this approach when I was implementing the logic for this rule. As I was looking through the existing JS proto library implementations, I came across this comment. It explains why having a user-defined import style is problematic in some cases.

After looking at #177, I agree with @mattem, it would be better if the output type could be requested. Currently ES6 code is not being generated, have you tried updating the rule to generate it separately? Would that work for your use case?

@kellycampbell
Copy link
Author

@Dig-Doug thanks. That makes sense. My use-case is server-side nodejs. I think the es6 method would work for that. @mattem do you already have something in progress for converting the protoc output files to es6?

@eordano
Copy link

eordano commented Jul 30, 2019

Hi there,

First of all, thank you very much for maintaining this library. I'm using bazel 0.28 and found @Dig-Doug's work very helpful (and recent)

Secondly, I feel that even though allowing users to specify the module mechanism might be problematic -- it's worse than the alternative (will have to fork).

@eordano
Copy link

eordano commented Jul 30, 2019

(I'm looking for es6 imports -- amd doesn't work for us)

@Dig-Doug
Copy link
Contributor

Hi @eordano, do you have some more info about the problem your having?

I had a need for es6 too and made some changes in #185. Have you tried those? If you're still having issues with the standard TS / JS bazel toolchain, we should fix them.

P.S. there is a pending PR for compatibility with 0.28 :)

@eordano
Copy link

eordano commented Jul 30, 2019 via email

@jonny-improbable
Copy link
Contributor

@kellycampbell, @Dig-Doug what are the suggested next steps for this PR? It's currently in conflict so it needs rebasing at the very least.

@Dig-Doug
Copy link
Contributor

Dig-Doug commented Aug 5, 2019

I actually tried using NodeJS yesterday myself and found a few issues :) -- I've submitted #194 to fix them.

@kellycampbell - Can you try out the changes in #194 and see if it works for you?

@jonny-improbable
Copy link
Contributor

@Dig-Doug is this pull now obsolete given #194 has been merged?

@Dig-Doug
Copy link
Contributor

Yes, I believe so. I've been using the TS protos in nodejs successfully.

@eordano
Copy link

eordano commented Aug 15, 2019 via email

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.

4 participants