react-measure
react-measure copied to clipboard
[Feature Request] Remove `add-module-exports` babel plugin
add-module-exports
plugin mimics babel-5
behavior and adds a magic module.exports = exports['default'];
statement if the module only has default
export. Although this is convenient but it is not the correct behavior and Babel 6
has removed this hack.
This problem is clearly explained on stackoverflow
https://github.com/59naga/babel-plugin-add-module-exports
Due to this plugin, react-measure
default export is undefined
when used with TypeScript
(at least in my project). If we really need to preserve the old behavior then having multiple bundles (UMD, UMD-legacy, ES6) would be really helpful
Thanks
Here is more info https://github.com/Microsoft/TypeScript/issues/5565#issuecomment-155216760
Also ran into this error: https://github.com/souporserious/react-measure/issues/37#issuecomment-333237534
Using:
import * as ReactMeasure from "react-measure";
const Measure: any = (ReactMeasure as any).Measure;
to work around the error but I obviously loose type checking.