Open shrpne opened 5 years ago
an es module would be much appreciated... currently using https://github.com/danimoh/jsQR but that lags behind with updates.
I have added browser
field targeting UMD version. Webpack will use it by default: https://webpack.js.org/configuration/resolve/#resolvemainfields
So this PR can be merged without breaking change. But still allows using module version by importing it directly:
import jsQR from 'jsQR/dist'
Or by changing Webpack's resolve.mainFields
to prefer module
field instead of browser
@basz FYI: https://github.com/danimoh/jsQR is now fully updated again and also includes several additional PR's which are still open here.
fixes #107 and #111
This PR can be a breaking change for people who use Webpack with Babel and target ES5 browsers because it introduces
module
field. By default, Webpack will start to use the file specified in themodule
, which is ES2015. And Babel by default will not transpile it because it ignores node_modules. So bundled js will contain ES2015 code and may fail in old browsers like IE11.So I suggest to release it under 2.0.0 and migration path will be to configure Babel properly if needed.