| ▲ | uticus 16 hours ago | |||||||||||||||||||||||||
I don't understand what "tree-shaking" means, can you point to a reference to give me a better understanding? | ||||||||||||||||||||||||||
| ▲ | nielsbot 15 hours ago | parent | next [-] | |||||||||||||||||||||||||
You might know it as "dead code stripping": You remove all the things from the image that aren't used in your shipping app. Calling it "tree shaking" is web development term AFAIK. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | shrubble 15 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
Tree shaking in this context is not unlike a compiler: it looks at all the code and determines if it will ever run in the image, eliminating any unnecessary code and delivering the minimal image needed. The code is in a “tree” format like an AST, and you’re shaking the tree to test what can be removed. | ||||||||||||||||||||||||||
| ▲ | pjmlp 14 hours ago | parent | prev [-] | |||||||||||||||||||||||||
I used a more recent term known to Web developers. It means going through the image and remove most code that isn't directly needed by the application, or only exists to support developer workflows. Usually needs a bit help for fine tuning, regarding what code to keep, and what to delete. You also find this on Java (jlink, ProGuard, D8/R8 on Android), and .NET (trimming, .NET Native manifests). | ||||||||||||||||||||||||||