-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fix: reduce huge bundle size by adding ADVANCED_OPTIMIZATIONS when compiling protobuf JS #128
Fix: reduce huge bundle size by adding ADVANCED_OPTIMIZATIONS when compiling protobuf JS #128
Conversation
This will also fixe #92 After optimization, the bundle size went from ~156KB to ~47KB (uncompressed) |
Thanks for porting this over! It looks like JSC is unhappy with @export annotations on functions that already have other visibility modifiers. If I'm aligning the errors correctly, some of the offending functions are currently marked as @Protected (e.g. Message.getRepeatedFloatingPointField). Is @export really required for these? |
Yes, since we are removing them from deps, we need to tell JSC to bring the required ones by putting
Do you have any idea on how we can fix them? |
I fixed one of the tests, but the other one is still failing:
|
It looks like it's not finding goog.global.console.error in commonjs testing mode. It looks like the closure output mode tests do pass though.. Digging around, I see that we have a rewriting script to produce a new version message_test.js for the purposes of testing commonjs. I'm suspicious of that script and how it may be interacting with tree shaking:
|
@dibenede, Thanks for the review, Yeah I've checked them and even tried to require the assertion library, but it seems cuz only this test is failing, because
and
when this IDK, maybe we can ignore this test, or we can rewrite it using other test functions rather than |
I attempted rewriting as well as deleting it, but there are other errors that crop up:
Based off the rewrite attempt, I think it's being set off by any assert* usage :/ |
First, I removed that test, and then the tests ran fine! Then, I fixed the test to throw an exception, and then the test is running fine now without removing it. |
@dibenede, I fixed these comments from @lukesandberg as well, and the tests are running correctly |
@dibenede, thanks for merging this. when will there be a new package release? so we can test this out. |
I'm actively working on #136, which is a blocker for release. I'm hoping we can cut a release next week. |
This will close: #124