Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: javascript
bundle-sizecode-splittingperformanceimports
Give lazily-loaded components their own entry point to keep chunks small
Importing one component from a barrel pulls the whole package into the lazy chunk; import via a dedicated subpath/entry so only what's needed is bundled.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | const Replies = lazy(() => import('ui-lib')); // drags in the entire library |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const Replies = lazy(() => import('ui-lib/replies-section')); // only this component |
Explanation (EN)
Objašnjenje (HR)