Closed colinrotherham closed 11 months ago
Not strictly a bug since since impact depends on:
window.GOVUKFrontend
directly?window.GOVUKFrontend
directly?window.GOVUKPrototypeKit.documentReady()
used to initialise safely?The simplest fix was to add type="module"
to application.js in:
Description of the issue
Prototypes using
window.GOVUKFrontend
will break when https://github.com/alphagov/govuk-frontend/pull/4264 is releasedWhy? Plugin scripts configured with
"type": "module"
execute after prototype JavaScript has already runSteps to reproduce the issue
Install the GOV.UK Frontend v5 preview (via GitHub commit)
Edit prototype app/assets/javascripts/application.js and add:
Open the prototype in a browser
Actual vs expected behaviour
Actual: GOV.UK Frontend global
window.GOVUKFrontend
is undefined Expected: Prototype scripts are also deferred, ensuringwindow.GOVUKFrontend
is availablePrototypes correctly using
window.GOVUKPrototypeKit.documentReady()
are unaffected