Have a look at the following two repo's:
- https://github.com/JelteMX/generator-mendix-widget
- https://github.com/JelteMX/widget-base
The generator uses widget-base as a starting point. If you look into the src folder, you will see that the widget is built using an ES6 setup. Furthermore, you'll be able to include any browser-compatible npm module in the widget. Here's for example one where I use a json component from NPM: https://github.com/JelteMX/mendix-json-widget