-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Break es6-shim into smaller, independent submodules #297
Comments
The most sane solution could be modularizing the shim and using something like webpack to make a browser-distributable library. Then, someone who only needs |
We definitely shouldn't be recommending something that modifies globals in a non-spec-compliant way, that's insanity. I'll fix the README, thanks. The problem here is |
I understand the reluctance to recommend a project that muxes global objects, but that's not the issue here. The issue is that ES6 Shim has a huge footprint and isn't distributed in a modular way. If you use one library that needs a small part of ES6 Shim (that's unrelated to promises), and another library that depends on something like How do you feel about supporting |
#136 covers that somewhat. That's not a bad approach, but it would mean we'd need to incorporate |
As the author of prfun, I agree the problem if any is in prfun. But I don't I don't think the mention of prfun in es6-shim is inappropriate -- unlike |
@cscott I don't know if it's worth fixing. The problem is that you augment native Promises, then As long as both |
@appsforartists please open a bug against prfun. prfun can use the same "is the promise insufficient" test that es6-shim uses. Alternatively, you can explicitly ask prfun to use es6-shim's promises, that's in the README. |
👍 |
Why don't you just use individual shims? |
@paulmillr total size and compatibility? For example, |
Just sayin', I'm reluctant to the idea of ES6 shim consisting of 20 npm submodules. maybe something what @appsforartists mentioned |
Why does the number of submodules matter? The size of the built JS file used in a browser would be basically equivalent, and "more dependencies" is a good thing :-) |
not when you see npm making 1000 requests to the server on a slow connection. Ask jdalton for his terrible experience with breaking down lodash |
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.) |
❤️ modules. |
@jdalton where are all github repos for lodash methods? |
@paulmillr - think files, not repos |
hmm interesting yeah, maybe that'll work. One repo, many files. |
+1 |
+1 |
It would be great to have the following bundles Math |
If and when we do this, you'll be able to import a la |
Libraries like
prfun
(incidentally recommended in thees6-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 gettingPromise.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
beforeprfun
, but the library that includesprfun
and the one that includeses6-shim
have nothing to do with each other. It'd be a shame to introduce a needless dependency to work around this.The text was updated successfully, but these errors were encountered: