Writing a library as an ES6 module is probably the most future-proof way. And it makes it a lot easier to use in Webpack.
One could argue that ES6 modules aren't widely supported, but they are available in Chrome 61 which is, at the moment, the only browser supporting WebUSB :)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
Writing a library as an ES6 module is probably the most future-proof way. And it makes it a lot easier to use in Webpack.
One could argue that ES6 modules aren't widely supported, but they are available in Chrome 61 which is, at the moment, the only browser supporting WebUSB :)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export