-
Notifications
You must be signed in to change notification settings - Fork 94
interoperate with rules_closure #6
Comments
right, we plan to re-use the closure compiler rules to get a single bundle file |
As a first approximation, would adding a outputFile option in a generated tsconfig file be possible? |
I think we more commonly want some other bundling tool that knows how to flatten modules, like rollup. @robwormald might look into it next week, angular and ngrx need it soon. |
Any luck on this? Feel free to ping me internally if there is any 20% stuff I can do to help 😄 |
I have a semi-working prototype but it requires google/closure-compiler#2641 to be submitted (at a minimum) due to google/closure-compiler#2637 which lines up with the timeline that Alex was talking about with the es6 module import issue |
Hi there, we're looking into using Bazel for our mixed TS/JS codebase at the moment. Interoperability with the Closure rules to build minified bundles is definitely a key aspect of making that work. It's great to see that this is being worked on! @achew22 could you clarify what timelines you were referring to in your comment? |
@alexeagle looks like the snapshot build of Closure compiler now has the fix for deterministic ordering. Does that mean we can actually do this? |
Sure, you can pick up from https://github.com/alexeagle/rules_typescript/tree/closure_js_binary?files=1 |
I think closure compiler is released now, so someone could pick this up. |
@alexeagle is there any update on this or #112 ? |
No update, we have been working more on rollup+uglify recently. I hope one
of the contributors will have time to push that feature forward.
Why does your code optimize poorly with uglify? I suspect that's relatively
easy to fix. Let's make a minimal example of using protobufs and grpc for
others to follow, and have the CI enforce that the result is optimizable?
…On Sun, Mar 4, 2018 at 11:43 PM Neri Marschik ***@***.***> wrote:
@alexeagle <https://github.com/alexeagle> is there any update on this or
#112 <#112> ?
We want to use protobuf + grpc-web but the resulting js file using rollup
are nearly 400kb.
I am expecting the size to go down using the closure compiler. Would be
comfortable to use it together with rules_typescript.
Thanks for your work!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC5I72OTJFf4O9S-pIE8hualSVGoqHuks5tbOy6gaJpZM4N0M0k>
.
|
I am not sure yet. Still in the middle of investigating. My front end dev told me using grpc is unacceptable because the bundle size is around 400kb. We are using https://github.com/improbable-eng/grpc-web/ which has a dependency on google protobufjs, that's all I think. Anyway, if I may ask, are you moving away from closure internally? In another PR / Issue you mentioned you don't want to support any closure stuff because it's not much used. Are you guys using grpc or protobuf from browsers? If so do you have much smaller file sizes? I will try to make an example using rules_typescript with grpc-web and rollup. edit:
That would mean that tree shaking is not supported, but maybe I am wrong. |
For comparison, I'm using an internal grpc-web front-end implementation that's all closure. The whole app (with closure templates and all) minifies down to 154kb with advanced compile/no debug symbols. IIRC the grpc part alone was about 80kb, so it is possible to have reasonable bundle sizes with gRPC. Have not tried with rollup but seems like it should be possible to get close to that. |
@pcj thanks for providing that reference data! Very helpful 👍 After doing some more investigation I found that the main culprits are the generated proto files.
The next big thing is
Sorry this went totally off-topic. I know this is not the protobuf repo, but do you have any guidelines or best practices to keep the generated proto files small? |
@alexeagle is there any progress on this? |
Nope, no progress.
…On Thu, Mar 22, 2018 at 9:44 AM Schmitt Christian ***@***.***> wrote:
@alexeagle <https://github.com/alexeagle> is there any progress on this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC5Iz0rPHkcT71S7Kp3lcCkICe8HhXlks5tg9T3gaJpZM4N0M0k>
.
|
@schmitch If you want to compile a ts library down to a .js file using the closure compiler, you can try |
Hmm, the `.closure.js` outputs from the standard upstream ts_library rule
should already be run through tsickle. I'm curious what was missing there
…On Thu, Mar 22, 2018 at 11:30 AM Ryan Brown ***@***.***> wrote:
@schmitch <https://github.com/schmitch> If you want to compile a ts
library down to a .js file using the closure compiler, you can try
https://github.com/ribrdb/rules_closure/tree/ts
With that you can add a ts_library in the deps of any closure_js_binary()
You may also need to use
https://github.com/ribrdb/rules_typescript/tree/closure to get the
typescript to run through tsickle before compiling it with closure.
I thought I sent a pull request for that, but it looks like I never did.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC5I4ZkauPk2f19ifZeTId2XXXQ8Hu8ks5tg-3HgaJpZM4N0M0k>
.
|
@alexeagle is there any examples of using EDIT: I got it to work, see #174 |
#344 has more recent discussion so let's continue there |
It would be nice to have a ts_binary rule that turns ts_libraries into a single .js file.
Unless I miss something and there's already a way to do this?
Maybe with bazelbuild/rules_closure, it would be possible to optimized the output code using closure_js_binary.
The text was updated successfully, but these errors were encountered: