Skip to content
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 ECMAScript Modules #1413

Open
lfdebrux opened this issue Jun 21, 2022 · 2 comments
Open

Use ECMAScript Modules #1413

lfdebrux opened this issue Jun 21, 2022 · 2 comments
Labels
🕔 Days A few unknowns, but we roughly know what’s involved. Tech debt

Comments

@lfdebrux
Copy link
Member

lfdebrux commented Jun 21, 2022

What

  • Upgrading the Kit package to use import
  • Upgrading the existing v13 prototypes to use import

Convert Node.js files in the Prototype Kit to use ECMAScript import, instead of CommonJS require, and set "type": "module" in package.json.

Why

New users familiar with using import to package their JavaScript code will find it confusing that the Kit uses the old method.

ECMAScript Modules are now the standard way to package JavaScript code, and Node.js and GOV.UK Frontend are both moving to prefer import over require. [1, 2]. Using ECMAScript modules will also let us use top-level awaits [3], which makes writing asynchronous scripts easier.

This change shouldn't affect users. Out of scope of this ticket is changing how JavaScript served to browsers by the kit is written.

Who needs to work on this

Developer

Who needs to review this

Developer

Done when

  • All Node.js files in the kit use ESM imports
  • The package.json for the kit sets the type to be ESM
@Izabela-16 Izabela-16 added 🕔 Days A few unknowns, but we roughly know what’s involved. and removed awaiting triage labels Jun 21, 2022
@joelanman
Copy link
Contributor

joelanman commented Mar 21, 2023

@ruthhammond
Copy link

To be broken down by @HannahJMWood and @ollie-b-gds into tasks so it can be picked off in pieces over time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕔 Days A few unknowns, but we roughly know what’s involved. Tech debt
Projects
None yet
Development

No branches or pull requests

4 participants