Skip to content

[hooks_runner] Avoid running hooks for packages that are completely tree-shaken #2437

@dcharkes

Description

@dcharkes

@mosuem Suggested we could avoid running the build (and link) hooks for packages that are listed as dependencies in the pubspec but that are not actually used.

In JIT: actually not used: 0 imports
in AOT: actually not used: after tree-shaking

Secondly, build hooks might depend on other build hooks (their metadata). So a build hook must also be run if another build hook that is run has in the package pubspec the other package. (I don't know how many hooks we might be able to skip if we also need to take this into account.)

If we discover the program code and no other hooks in practice depend on a build hook we should be able to skip it.

We cannot skip anything when hot-reload or hot-restart is enabled, because code using an asset might be added.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions