-
Notifications
You must be signed in to change notification settings - Fork 328
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
Spike ways of cutting the mustard (e.g. guarding everything with a feature check) #3264
Comments
Thoughts from @colinrotherham:
|
If we focus the mustart-cutting side to the scenario where service teams load the whole bundled file from the release Zip (and follow our Getting Started), we should also consider what's the impact for services that have their own bundlers/assets-pipelines and if our solution can work for them (capabilities of their tools to set it up and/or overhead on their build). |
It'd probably be beneficial to complete #3292 asap so we have a sense of where our current features might cut us off anyway. Also, @colinrotherham offered up using browserslist as a potential topic for knowledge-sharing, so maybe that'd be a good thing to prioritise as well so everybody has the same browserslist foo. |
Thanks @stevenjmesser, I've improved my previously-scruffy notes above! |
Write up available (though not publicly) at: https://docs.google.com/document/d/180C-e5giOKQBZbh78skcNzE2o1DialI-0kBEgH_kP48/edit?pli=1# Next step: #3369 |
What
Spike alternative ways to cut the mustard. For example, returning early if the browser does not support a feature like
Promise.prototype.finally()
in order to provide a “cut” where only the browsers that supportPromise.prototype.finally
execute the rest of the JavaScript.Promise.prototype.finally()
is only picked as an example – we should explore other features that Browserslist supports.We might also need to think about:
js-enabled
class to the bodyChecklist
Why
One way of doing this is to load our JavaScript using the
type="module"
attribute in the script tag. 'Modern' browsers understand what this means whilst older browsers like IE11 ignore it. However, with this approach 'modern' browsers includes browsers going back to 2017 (Chrome 61, Edge 16, Safari 10.1, Opera 48) and includes versions of browsers which according to our analytics data are not really used.Assuming we want to try and provide a 'clean' cut – i.e. only run JS if it's going to run successfully – we may end up providing polyfills, or avoiding features, in order to support browsers that nobody are really using.
Spiking alternative approaches may give us a better solution with a more sensible way to make this cut.
Assumptions
Timebox
We timeboxed this to 21 Feb.
Who is working on this?
Spike lead: Romaric
Spike buddy: Brett & Colin
Questions to answer
Thinking in terms of arrow functions, try… (optional) catch, Promise: finally, Error: cause
Service teams will need to take care that tracking and analytics doesn't delay component load
For our Cookie banner (client-side only) can we hide it behind a cut-the-mustard check?
JavaScript modules use this globalThis, will that cause window.GOVUKFrontend problems?
Done when
You may find it helpful to refer to our expected outcomes of spikes.
The text was updated successfully, but these errors were encountered: