ember-cli-babel
ember-cli-babel copied to clipboard
Create a target specific polyfill.
Instead of importing the full babel-polyfill we create a polyfill that supports the specific targets the app has declared.
This dramatically reduces the cost of setting includePolyfill: true when your targets are newer. For example, with last 1 chrome versions as the list of targets, you save 4kb after min+gz (roughly 50% of the total polyfill size).
TODO:
- [ ] Fix CI
- [ ] Ensure we add
regeneratorRuntimewhen needed by the given targets.
CI is currently failing due to a new assertion added to ember-cli-htmlbars-inline-precompile (which checks if the host project has a new enough version of ember-cli-babel).
@stefanpenner - Would love general thoughts on this before I go too far down the rabbit hole...
Would love to see this! 👍
@rwjblue not sure about your numbers, shouldn't the savings be substantially more? I see the whole polyfill at ~30kB (min+gz)
@simonihmig - Been a while since I've looked at it, haven't had much time to try to push this over the hump. Would love help if you are interested..
@rwjblue If @simonihmig doesn't have time I'd be interested in looking into this. I just spent several days working around something that this would have been perfect for ;-)
@eshtadc feel free to do so! Would love to help, but time is very limited atm, with day job and other OSS. Btw, noticed today that this PR was subject of a discussion on #dev-ember-cli, so maybe others are interested to give a helping hand? cc @cibernox @t-sauer
@rwjblue I have a rebased version of this PR at https://github.com/andyhot/ember-cli-babel/commits/target-based-polyfill (also fixes a minor issue with the targets-parser)
Do you see this going forwards?
@andyhot - Absolutely interested in pushing forward on this, just haven't had much time lately. If you'd like, feel free to open up a new PR (or PR against my branch here) and we can try to continue to move things forward...
Great. Well, I already have a PR for this against ember-cli-babel#6.8.2. Should I try to rebase against master (7.0.0-alphas) or is that good enough?
Well, I already have a PR for this against ember-cli-babel#6.8.2.
Hmm, I'm confused by this. I don't see any PR's here or against my fork. Can you link me to the PR you had already created?
Meant to say have the code ready - but hadn't done a PR since your master branch is really old. Anyway, I opened https://github.com/rwjblue/ember-cli-babel/pull/1 that updates your master to 6.8.2 and then adds the commits included here + a fix needed for targets-parser
I also went ahead and opened a PR here (against master) which is easier to examine since it only contains 2 commits - https://github.com/babel/ember-cli-babel/pull/187. Feel free to remove the other one
What's the status of this?
For anyone following along here, https://github.com/pzuraq/ember-cli-babel-polyfills may be of interest
Going to close this as polyfill support was removed in v8.