openexchangerates / money.js

money.js is a tiny (1kb) javascript currency conversion library, for web & nodeJS
http://openexchangerates.github.io/money.js
MIT License
1.46k stars 127 forks source link

(patch) cannot import as es6 module #34

Open cristinecula opened 5 years ago

cristinecula commented 5 years ago

this is undefined when imported as es6 module.

Include detection from umd: https://github.com/umdjs/umd/blob/master/templates/amdWeb.js

This makes importing as es6 module work:

import 'money';
window.fx.convert(...)

Ideally the module should be rewritten to export fx directly, instead of registering to window, but this gets the job done.

import { fx } from 'money'
fx.convert(...)