Bundle ES modules to browser with Browserify

2019-11-12 Update:

We can use gulp to simplify the workflow:

Below is the original post:

Firstly, install related dependencies with npm:

Then, create a glue script (here we can name it main.js) to inject the ES module to be a window property.

For the last step, use browserify to bundle modules and uglifyjs to minify the script (remove all comments for example).