Convert code to ES6 modules

Opening PR to track the final stages of this project:

- [ ] Verify all fields exposed by the globals object
- [ ] Note possibly breaking changes