-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use type=module for application.js #6846
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, the JS error appears to be caused by the closest polyfill imported from the publishing components gem and using type="module".
If this PR could also include the upgrade to the gem that removes support for older browsers and polyfills when released, this will resolve the issue.
Further info on the error:
Uncaught TypeError:
Cannot read properties of undefined (reading 'Element')
at application.js:3:6
The reason for this appears to be that a top level this
is undefined
when used in a module, before this change it was the window
object - https://exploringjs.com/es6/ch_modules.html#sec_modules-vs-scripts
6c38359
to
fac6c31
Compare
fac6c31
to
168a67a
Compare
168a67a
to
83ea9fe
Compare
What / Why
static
first before this is merged.es6-components.js
again as a separate task unless you disagree with thisgovuk_publishing_components
branch linked above. If you test without this, this app'sapplication.js
seems to crash.