Lazy finders
Use lazy finders at module scope:@webpack/common:
CSS classes
UsefindCssClassesLazy for Discord’s mangled class names:
Declarative patches
Webpack source patches live on the plugin object:$self only for methods that live on the plugin object.
Patch rules
- Prefer string
findanchors. - Use stable strings such as intl keys, action types, paths, or distinctive code.
- Keep regex gaps bounded, usually
.{0,150}?. - Capture only what you reuse.
- Use
group: truewhen multiple replacements must succeed together. - Use
predicate,fromBuild, ortoBuildfor version or target gates. - Keep replacement strings small and move logic into plugin methods.

