Toolverse
All skills

bundle-dynamic-imports

by TheOrcDev

Use next/dynamic for lazy-loading heavy components. Apply when importing large components like editors, charts, or rich text editors that aren't needed on initial render.

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Author
TheOrcDev
Category
Frontend
Views
3

About this skill

Use next/dynamic for lazy-loading heavy components. Apply when importing large components like editors, charts, or rich text editors that aren't needed on initial render.

How to use

  1. Zidentyfikuj w swoim projekcie Next.js komponenty, które są ciężkie i ładują się na żądanie — typowe przykłady to edytory kodu (Monaco), biblioteki do rysowania wykresów czy zaawansowane edytory tekstu. Sprawdź, czy naprawdę są potrzebne podczas pierwszego renderowania strony.

  2. Zamiast tradycyjnego importu (np. import { MonacoEditor } from './monaco-editor'), użyj funkcji dynamic z pakietu next/dynamic. Opakowaniem komponent w dynamic() i przekaż funkcję, która importuje moduł dynamicznie.

  3. W opcjach dynamic() ustaw { ssr: false }, aby zapobiec renderowaniu komponentu na serwerze. To jest ważne dla komponentów, które wymagają dostępu do API przeglądarki (DOM, window itp.).

  4. Użyj komponentu w swoim kodzie dokładnie tak samo jak wcześniej — nie musisz zmieniać logiki renderowania. Różnica jest całkowicie przezroczysta dla reszty aplikacji.

  5. Przetestuj aplikację i sprawdź w narzędziach deweloperskich (DevTools), że bundle główny jest mniejszy, a komponent ładuje się dopiero gdy go wyświetlisz. Możesz zobaczyć nowy chunk w zakładce Network.

  6. Powtórz ten proces dla każdego innego ciężkiego komponentu, który nie jest wymagany na starcie — każdy dynamiczny import zmniejszy rozmiar głównego bundle'a i przyspieszy ładowanie aplikacji.

Related skills

brainstorming

by obra

Use when creating or developing, before writing code or implementation plans - refines rough ideas into fully-formed designs through collaborative questioning, alternative exploration, and incremental validation. Don't use during clear 'mechanical' processes

Frontend
49170

shadcn-ui

by josechifflet

shadcn/ui component patterns for Next.js 16 applications. This skill should be used when adding UI components, customizing component styles, composing primitives, or integrating forms with react-hook-form. Covers installation, customization, composition patterns, and

Frontend
157206

screenshot-to-code

by OneWave-AI

Convert UI screenshots into working HTML/CSS/React/Vue code. Detects design patterns, components, and generates responsive layouts. Use this when users provide screenshots of websites, apps, or UI designs and want code implementation.

Frontend
94209

zustand

by lobehub

Zustand state management guide. Use when working with store code (src/store/**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.

Frontend
36126

angular

by sickn33

Modern Angular (v20+) expert with deep knowledge of Signals, Standalone Components, Zoneless applications, SSR/Hydration, and reactive patterns. Use PROACTIVELY for Angular development, component architecture, state management, performance optimization, and migration to modern

Frontend
2656

dev-browser

by SawyerHood

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include \

Frontend
38151