es6-shim: Break es6-shim into smaller, independent submodules
Libraries like prfun (incidentally recommended in the es6-shim README) augment the Promise prototype with additional methods. Promise.promisify is particularly nice.
I just tried incorporating the es6-shim into my Node 0.11.13 project to get access to the Array polyfills. Now, I’m getting Promise.promisify cannot be found errors. A quick skim through the shim source shows that es6-shim completely overwrites the global Promise object with its own polyfill when it isn’t satisfied with the present implementation.
I could probably work around this by including es6-shim before prfun, but the library that includes prfun and the one that includes es6-shim have nothing to do with each other. It’d be a shame to introduce a needless dependency to work around this.
About this issue
- Original URL
- State: open
- Created 10 years ago
- Comments: 23 (7 by maintainers)
Commits related to this issue
- Correcting this Promise test description. — committed to es-shims/es6-shim by ljharb 9 years ago
It would be great to have the following bundles
Math String Number Promise RegExp Array Object Reflect Collection Symbol
As a Webpack user, a monolithic library that touches a bunch of unrelated native prototypes is very unappealing. I didn’t know about core-js when I opened this issue, but now that @zloirock has shared that link, I may go there the next time I need a polyfill because of its modularity.
(FWIW, I think @ljharb is on the right track - if you want to release a single file, just run Webpack over your repo. There’s no reason to have all your code in a single script. That said, I’m unfamiliar with @jdalton’s experience with lodash.)