Skip to content

Commit

Permalink
Action 2i recommendations to improve release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
EoinShaughnessy committed May 16, 2022
1 parent d922e6e commit 3637e33
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

### New features

#### Import GOV.UK Frontend JavaScript as ES modules
#### Import GOV.UK Frontend JavaScript as ECMAScript (ES) modules

You can now import our component JavaScript into your service as ES modules, if you're using a bundler.

This change allows you to import only the JavaScript you need, and helps reduce duplication of polyfills.

As we're now shipping ES modules in addition to how we already ship JavaScript (using UMD, or Universal Module Definition), this change is backwards compatible. You will not be required to make any changes unless you want to.
Because we're shipping ES modules in addition to how we currently publish our component JavaScript, this change is backwards compatible. You will not be required to make any changes unless you want to.

To import our ES modules, use `import` to only import the JavaScript for components you're using in your service. For example:
If you want to import using ES modules, we recommend you only use `import` to import the JavaScript for components you're using in your service. For example:

```javascript
import { SkipLink, Radios } from 'govuk-frontend'
Expand All @@ -30,14 +30,14 @@ if ($radios) {
}
```

If you need to import all of GOV.UK Frontend's components, then run the `initAll` function to initialise them:
If you need to import all of GOV.UK Frontend's components, then use the `initAll` function to initialise them:

```javascript
import { initAll } from 'govuk-frontend'
initAll()
```

Depending on the bundler you use, you may also need to make changes to your JavaScript bundler configuration file. [Read more in our installation instructions about importing JavaScript using a bundler](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#import-javascript-using-a-bundler).
Depending on the bundler you use, you may also need to make changes to your JavaScript bundler configuration file. You can [read more in our installation instructions about importing JavaScript using a bundler](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#import-javascript-using-a-bundler).

This was added in [pull request #2586: Publish our JavaScript as ES modules alongside Universal Module Definition (UMD)](https://github.com/alphagov/govuk-frontend/pull/2586).

Expand Down

0 comments on commit 3637e33

Please sign in to comment.