TIL that it's possible to dynamically import a JSON file in JavaScript:
const json = (await import("team.json")).default;
import
returns a promise, so async/await can be used. We then need to access
property default
, since import
only supports default export.
Find out more about import()
here.