A reusable pattern for dynamically loading custom elements without bundling. The approach uses naming conventions (class names matching file names with a configurable suffix), static initialization blocks for self-registration, and dynamic imports to load only the custom elements present in the DOM. The pattern supports both initial page load and runtime element insertion via MutationObserver, includes interdependency handling through custom events, and achieves tree-shaking benefits without requiring a build step. Complete implementation is approximately 1KB.
Sort: