Dynamic require() Ant-Only Escape Hatches
- Entity ID:
ent-20260420-b01a00000013 - Type:
pattern - Scope:
shared - Status:
active - Aliases: USER_TYPE===ant require pattern, ant require guard
Description
Code pattern throughout the leaked source where dynamic require() calls are gated behind process.env.USER_TYPE === 'ant' so Anthropic-internal packages (not shipped to external users) are never loaded on external builds. During esbuild bundling these require calls can fail module resolution; strategy is to wrap/stub them rather than bundle them, since the flag path is dead for external users anyway.
Key claims
- Ant-only dynamic require() calls must be stubbed to avoid esbuild resolution failure