You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- **HeavyMarkdownEditor**: 2.2MB total resources (2.7MB with markdown libraries)
475
+
- HeavyMarkdownEditor.js: 26.5 kB
476
+
- HeavyMarkdownEditor.css: 5.5 kB
477
+
- Markdown libraries: 1,081 kB additional
478
+
- Shared runtime: ~1.1MB (React, webpack runtime)
472
479
473
-
Each page loads only what it needs!
480
+
**Bundle splitting benefit**: Each page loads only its required components - the HelloWorld page doesn't load the heavy markdown libraries, saving ~1.1MB (50% reduction)!
*Screenshots show browser dev tools network analysis demonstrating the dramatic difference in bundle sizes and load times between the two components.*
474
491
475
492
### Server Rendering and Client Rendering Components
476
493
@@ -505,11 +522,19 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
505
522
506
523
**Problem**: Components load but CSS styles are missing or delayed.
507
524
525
+
**Important**: FOUC (Flash of Unstyled Content) **only occurs with HMR (Hot Module Replacement)**. Static and production modes work perfectly without FOUC.
526
+
508
527
**Solutions**:
509
-
- **Development with HMR**: FOUC is expected. Use `bin/dev static` mode for development without FOUC
510
-
- **Production**: Ensure CSS extraction is working by checking for `.css` files in `public/packs/css/generated/`
511
-
- **Layout**: Verify your layout includes empty `<%= stylesheet_pack_tag %>` placeholder
512
-
- Check that CSS files are properly imported in your components: `import styles from './Component.module.css';`
528
+
- **Development with HMR** (`./bin/dev`): FOUC is expected behavior due to dynamic CSS injection - **not a bug**
529
+
- **Development static** (`./bin/dev static`): No FOUC - CSS is extracted to separate files like production
530
+
- **Production** (`./bin/dev prod`): No FOUC - CSS is extracted and optimized
531
+
- **Layout**: Verify your layout includes empty `<%= stylesheet_pack_tag %>` placeholder for CSS injection
532
+
- **Component imports**: Check that CSS files are properly imported: `import styles from './Component.module.css';`
533
+
534
+
**Key insight**: Choose your development mode based on your current needs:
535
+
- Use HMR for fastest development (accept FOUC)
536
+
- Use static mode when testing styling without FOUC
537
+
- Use production mode for final testing
513
538
514
539
#### 3. "document is not defined" errors during SSR
0 commit comments