Skip to content

Commit

Permalink
Add Browserslist javascripts environment for JavaScripts
Browse files Browse the repository at this point in the history
We’re using Safari 11 as a minimum so that checks for `nomodule` will also pass

```
'noModule' in HTMLScriptElement.prototype
```

Using the query `> 0.1% in GB` unintentionally brings in Safari on iOS 8.1-8.4, 9.3 with only Safari 9+ supporting ES2015 modules, and Safari 11+ supporting `nomodule`
  • Loading branch information
colinrotherham committed Jun 20, 2023
1 parent 52e2653 commit caa3839
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/examples/webpack/.browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ Firefox ESR
Safari >= 12
iOS >= 12.1

[javascripts]
> 0.1% in GB and supports es6-module
last 6 Chrome versions
last 6 Firefox versions
last 6 Edge versions
last 2 Samsung versions
Firefox ESR
Safari >= 12 and not Safari < 11
iOS >= 12.1 and not iOS < 11

[stylesheets]
> 0.1% in GB and not dead
last 6 Chrome versions
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/webpack/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
module.exports = function (api) {
const browserslistEnv = !api.env('test')
? 'production'
? 'javascripts'
: 'node'

return {
Expand Down
10 changes: 10 additions & 0 deletions packages/govuk-frontend-review/.browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ Firefox ESR
Safari >= 12
iOS >= 12.1

[javascripts]
> 0.1% in GB and supports es6-module
last 6 Chrome versions
last 6 Firefox versions
last 6 Edge versions
last 2 Samsung versions
Firefox ESR
Safari >= 12 and not Safari < 11
iOS >= 12.1 and not iOS < 11

[stylesheets]
> 0.1% in GB and not dead
last 6 Chrome versions
Expand Down
10 changes: 10 additions & 0 deletions packages/govuk-frontend/.browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Firefox ESR
Safari >= 12
iOS >= 12.1

[javascripts]
> 0.1% in GB and supports es6-module
last 6 Chrome versions
last 6 Firefox versions
last 6 Edge versions
last 2 Samsung versions
Firefox ESR
Safari >= 12 and not Safari < 11
iOS >= 12.1 and not iOS < 11

[stylesheets]
> 0.1% in GB and not dead
last 6 Chrome versions
Expand Down

0 comments on commit caa3839

Please sign in to comment.