Shopify/packwerk

[Bug Report] Default require behaviour

gmcgibbon opened this issue · 0 comments

Description
Requiring packwerk via require "packwerk" (the default require) sets autoloads and some upfront requires. Tools like T::Utils.run_all_sig_blocks triggers signatures to be evaluated, which expands Packwerk into memory as it loads constants in sigs.

To Reproduce
A scenario like #334 using T::Utils.run_all_sig_blocks.

Expected Behaviour
T::Utils.run_all_sig_blocks should not inflate Packwerk into memory.

Screenshots
N/A

Version Information

  • Packwerk: edge
  • Ruby 3.2.1

Additional Context
We don't seem to want to encourage developers reach for require: false as of #304. What we can do instead is remove the requires from the main entrypoint file and make sure no more are added (and thus no sigs evaluated). We don't seem to want to move autoloads out of the default require for API design reasons.