Wydajność
perf/render-blocking-script
A script in the head loads with defer, async or type="module", never as a plain blocking script.
umiarkowanastatycznefe-html
Dlaczego
A classic <script src> in the head stops HTML parsing until the file is downloaded and run, which delays the first paint and the Largest Contentful Paint.
Poprawka
Add defer (runs in order after parsing; the usual choice) or async (runs as soon as it arrives; for independent scripts such as analytics), or load it as type="module", which defers by default.
Przykłady
<!-- bad -->
<script src="/app.js"></script>
<!-- good -->
<script src="/app.js" defer></script>Źródła
Fakty
- Identyfikator
perf/render-blocking-script- Waga
- umiarkowana
- Sprawdzanie
- statyczne sprawdzane w kodzie źródłowym przez
audit - Dotyczy plików
html- Ten sam problem w
- Lighthouse
render-blocking-insight - Uczy jej skill
fe-htmlHTML documents and semantics- Od wersji
- 0.1.0
Przeczytaj w terminalu
npx github:dawidolko/frontend-skills explain perf/render-blocking-script