Performance: Public directory for static assets
MEDIUM IMPACT
This affects page load speed by controlling how static files like images, fonts, and scripts are served directly without extra processing.
<script src="/analytics.js" defer></script> // Placing analytics.js in the public directory and referencing it directly
import '../assets/analytics.js'; // Importing JS files bundles them into the app's JavaScript bundle
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Importing assets in JS bundle | Low | 0 | High (due to delayed load) | [X] Bad |
| Serving assets from public directory | Low | 0 | Low (loads early) | [OK] Good |