Use proto library that provides tree-shakeable code
See original GitHub issueProblem
ts-proto
generate code that is not tree-shakeable. See https://github.com/status-im/status-web/issues/233
This is an issue as it inflate the package size for library consumers.
It also uses Buffer
.
Solution
Possibly investigate using ipfs/protons
or protobuf-js
directly.
Definition of Done
- New library that generate tree-shakeable code is used
- Definition from https://github.com/vacp2p/waku are used
Bonus
js-waku currently uses bufbuild and ts-proto which has several downsides:
- bufbuild is a separate binary that has to be installed
- ts-proto generates code that uses
Buffer
It also has pros: - Generated code is TypeScript
- Generates from proto files
Review whether we can use the solution for the examples in js-waku too.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How To Make Tree Shakeable Libraries - Theodo blog
Tree shaking is a way to achieve dead code elimination by ... Most libraries will use CJS modules because it allows them to...
Read more >Library mode output not tree-shakeable when consumed by ...
Describe the bug When writing a library using vite "library mode," the output is expected to be tree-shakeable regardless of where it is...
Read more >How to build tree-shakeable JavaScript libraries - Cube Blog
You'll know to write JavaScript code in a tree-shakeable way and produce smaller bundles. If you're building a JavaScript library, ...
Read more >Tree shaking - The newline Guide to Creating a React Hooks ...
Tree shaking is the process of removing unused code from your bundle. When you develop your modern web app, you usually use tools...
Read more >Tree-Shaking Problems with Component Libraries - Medium
If you're publishing a component library, offer an ES Module build — and avoid ... Use ES2015 module syntax (i.e. import and export...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maintenance has been resumed 🎉 https://github.com/ipfs/protons/commit/74d3b7abf1e857f7320c100734e797855ea728c1
Focusing this issue in the tree-shakeable problem.
I’ve also detected that generated files are not tree-shakeable, leaving a lot of unused code in the final bundle. See more: https://github.com/status-im/status-web/issues/233. I will investigate, whether there are some possibilities to optimize.