Plugin scripts with "type": "module"
run too late
#2353
Labels
🐛 Bug
Something isn't working the way it should (including incorrect wording in documentation)
Description of the issue
Prototypes using
window.GOVUKFrontend
will break when alphagov/govuk-frontend#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)
npm install --save "alphagov/govuk-frontend#5b2bfde4f"
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 undefinedExpected: Prototype scripts are also deferred, ensuring
window.GOVUKFrontend
is availablePrototypes correctly using
window.GOVUKPrototypeKit.documentReady()
are unaffectedThe text was updated successfully, but these errors were encountered: