benlesh / symbol-observable

Symbol.observable ponyfill

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a Rollup-compatible ES modules build

gaearon opened this issue · comments

commented

Redux depends on this library now, which breaks ES modules build of Redux. It would be great if we could offer an ES modules build of this library in /es/ and point jsxnext:main to it.

Seems reasonable

@gaearon I just thought of something (Although I haven't looked into this yet). Recreating this with ES6 will need to be done by hand I think, because if I rewrite it in ES6, the transpiled CJS will require it to be used like require('symbol-observable').default I think. That will be a breaking change for everyone using this. :\

If you are only exporting a default. You can use this: https://www.npmjs.com/package/babel-plugin-add-module-exports.

There were good reasons babel changed the behavior though: https://phabricator.babeljs.io/T2212#57710

commented

You can use this: https://www.npmjs.com/package/babel-plugin-add-module-exports.

Yeah, this is what I had in mind. I haven’t tried it though.

@jamestalmage oh, thanks, I didn't know about the plugin. I just knew the reasons babel wouldn't do it. It's probably totally safe for this project, since there's just the one export.

Thanks that worked great