Git Product home page Git Product logo

Comments (3)

liuly0322 avatar liuly0322 commented on June 29, 2024

#349

@wmhilton Currently, the only JavaScript optimizer (that I am aware of) that can do dead code elimination on class methods is the Google Closure Compiler. It does a lot of awesome optimizations that other tools (e.g. Webpack, Uglify, Rollup) do not do.
However, in order to achieve those optimizations, it requires you to follow various restrictions. Those restrictions means that most JavaScript libraries won't work. Generally, only code which has been specifically written for Google Closure Compiler will work.

As JavaScript is a highly dynamic language, it is hard to decide if meta info of a class will be used, or if the class will be passed as a whole and used by other unknown methods, unlike "top-level" function themselves can be easily identified all uses.

Maybe farer future. This would be rather complex to get right, object expression tree-shaking should probably come first, and that one is currently far down the pipeline

#5420 may achieve object expression tree-shaking! So maybe in future, the class method tree-shaking will be supported.

from rollup.

lukastaegert avatar lukastaegert commented on June 29, 2024

Exactly! I still need to find some time to properly review it, but the goal is to at least lay the groundwork for this. Once we can control object properties, we can start looking into the additional complexities of classes.

from rollup.

malee1975 avatar malee1975 commented on June 29, 2024

Sounds good :)

from rollup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.