souporserious/react-measure

[Feature Request] Remove `add-module-exports` babel plugin

Opened this issue · 2 comments

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

Also ran into this error:
#37 (comment)

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.