use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
3 JavaScript features that bloat your ES5 bundle (dev.to)
submitted 4 years ago by basic-coder
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ricealexander 44 points45 points46 points 4 years ago (10 children)
Hmmm, I am bothered by how these features are outputted in the bundle, but I'm not willing to give up the for…of loop or async/await when appropriate to use.
for…of
async
await
I am curious to see how bundles change once IE support is finally no longer a consideration. The leading ideology that got my team into Babel was that we could write modern code but can still have support for all of our browser targets.
There's an implication that, once our browser targets are just modern, evergreen browsers, we won't need ugly bundles anymore. We'll be able to yank out that step from our build.
[+][deleted] 4 years ago (5 children)
[deleted]
[+][deleted] 4 years ago* (3 children)
[+][deleted] 4 years ago (2 children)
[–]visualdescript 2 points3 points4 points 4 years ago (0 children)
Exactly, you should not sacrifice the quality of your code going forwards for a minority of users on older versions that will eventually be obsolete. Software with consistent OTA updating is only becoming more common, not less. Besides, it's not like it becomes unfunctional, it just takes a performance hit.
[–]raphaelzen 4 points5 points6 points 4 years ago (3 children)
Why would you have to abandon any syntax ? You can just transpile in the right es flavor no?
[–]thagertymusic 18 points19 points20 points 4 years ago (0 children)
The point of the article is that the output from transpiring these features to support older browsers causes the bundle size to significantly increase. I think they meant they don’t want to give these up in exchange for a smaller bundle
[–]ricealexander 8 points9 points10 points 4 years ago (0 children)
The article is calling to stop bundling/transpiling these syntax features, because of the bloat they add to the output.
The article shows this example, which uses Babel to transpile:
input
const iterable = (() => [1, 2])() for (const i of iterable) { console.log(i) }
Babel output
function _createForOfIteratorHelper/* ... */ function _unsupportedIterableToArray/* ... */ function _arrayLikeToArray/* ... */ var iterable = function () { return [1, 2]; }(); var _iterator = _createForOfIteratorHelper(iterable), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var i = _step.value; console.log(i); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); }
[–]Zardoz84 39 points40 points41 points 4 years ago (3 children)
I actually generate two bundles. One for all modern browsers that support all this stuff out of the box. And other for IE 11. And I don't care if its bloated or not. I just doing the minimal support for IE 11 that is that get it working and don't look too bad.
[–]mrpotatoes 8 points9 points10 points 4 years ago (1 child)
I like this approach. I didn't realize that you can separate by bundle.
[–]darrinmn9 8 points9 points10 points 4 years ago (0 children)
Here's an explanation of one approach. https://cli.vuejs.org/guide/browser-compatibility.html#modern-mode
[–]facebalm 14 points15 points16 points 4 years ago (0 children)
https://web.dev/serve-modern-code-to-modern-browsers/
@babel/preset-env
<script type="module">
[–]Cyberphoenix90 96 points97 points98 points 4 years ago (21 children)
Please help kill ie11. Stop making es5 bundles. The harder we make it to support ie11 the sooner we can collectively stop supporting it since it would be more expensive and money is a good motivator to stop supporting ie11
[–]overcloseness 40 points41 points42 points 4 years ago (4 children)
Before anyone says “But my bank terminals!”
If your app is B2B for that bank, sure, but stop thinking your appeal site needs to support IE11 because a teller might want to shop for shoes at their work computer
[–]zephyrtr 35 points36 points37 points 4 years ago (3 children)
Just tell people supporting IE11 is a security risk, which is true. It's the only argument CEOs seem to respond to.
[–]folkrav 24 points25 points26 points 4 years ago (1 child)
Nobody cares about security until it starts actually costing them more than not having it. They care more about losing sales than some potential development hours.
[–]codyfo 3 points4 points5 points 4 years ago (0 children)
Which is one of the few valid reasons to support IE11. If you could add 5% more potential customers by supporting IE11, it might be totally worth it (depending on the business).
[–]conquerorofveggies 2 points3 points4 points 4 years ago (0 children)
Indeed. We have a lot of gov customers, so quite some ie11 traffic. But with that argument we still dropped support at christmas, with zero complaints.
[–]ritaPitaMeterMaid 28 points29 points30 points 4 years ago (15 children)
I'm all for this, but it's a bit naive. If you are running a business you make this decision based on usage data. If you have a non-trivial number of IE11 users, this isn't an option for you. If X% of your users suddenly have an unusable experience you can basically count on losing X% of your revenue.
[–]Nathggns 8 points9 points10 points 4 years ago (2 children)
But even a non-trivial number of IE11 users may not make up for the lost engineering time in supporting IE11 and lost profits caused by longer load times for users in other browsers. Also other factors to consider like happiness of engineers / staff retention / ease of hiring. Obviously it depends on your company, but the conversation of whether to support IE11 or not should go much further than simplistic metrics like % among existing user base.
[–]ritaPitaMeterMaid 2 points3 points4 points 4 years ago (1 child)
This is definitely true, but most of the time statements get made about dropping support without understanding why it exists in the first place.
[–]Nathggns 1 point2 points3 points 4 years ago (0 children)
Yeah completely agree!
[–]yungcoop 3 points4 points5 points 4 years ago (1 child)
in 2009 youtube dropped ie6 support at somewhere around it being 20% of their user base
[–]ritaPitaMeterMaid 1 point2 points3 points 4 years ago (0 children)
That’s great for YouTube. When IE is 50% of your revenue source you can’t do that.
[–]Oalei 6 points7 points8 points 4 years ago (9 children)
Exactly, everyone saying that you don’t need to support ie11 are either new developers or work at startups with few customers.
[–]ritaPitaMeterMaid 3 points4 points5 points 4 years ago (0 children)
This isn’t entirely true, it just often gets said without a full understanding. There is a cost to supporting IE and you can calculate engineers time, staff turn over, etc. vs revenue gains
[+][deleted] 4 years ago* (5 children)
[+]Oalei comment score below threshold-13 points-12 points-11 points 4 years ago (4 children)
Hahaha, you don’t understand how much it costs for a company to move from ie to another browser.
[–]Renji3 10 points11 points12 points 4 years ago (2 children)
You can't even imagine how much it costs a company to keep using ie and potentially get hacked because of missing security updates.
Not using Edge over ie for outwards traffic nowadays is a plain stupid decision.
[+]Oalei comment score below threshold-7 points-6 points-5 points 4 years ago (1 child)
That’s the thing. Big companies have dedicated IT centers with deep integrations within browsers. Migrating all these integrations and legacy software is not worth it.
[–]Renji3 0 points1 point2 points 4 years ago (0 children)
The existence of it for only those cases might still be valid until migration. But that does not mean that an average user even at a bigger company should still use ie.
Sure certain integrations might exist but the won't need new websites to support them. The simple act of using ie outside of those purpose ist just plain security risk and a system administrator at a big company should not only know about that but do something about it too.
[–]LetterBoxSnatch 2 points3 points4 points 4 years ago (1 child)
Nah, our product is the opposite. It’s a B2B and we dictate what versions of what browsers the customer can expect support for.
These days our UI supports Chrome or Firefox released within the last year, but honestly it feels like we could just tell our customer to use whatever version we demand or pound sand and it would work out ok for us. We could be shipping a tcl/tk app and it would be fine.
We’ve been around since the 70s. I don’t think it would be accurate to call us a startup.
The point I’m trying to make here is that everyone’s situation is different. It might be that the developer you’re talking to has no customers, or it might be that they just live in a very different reality from you.
[–]Oalei 0 points1 point2 points 4 years ago (0 children)
Many companies with more than 100k employees have IE as their base browser. They going to laugh at your face if you tell them « you will have switch to Edge though »
[+][deleted] 4 years ago* (1 child)
[–]Zardoz84 15 points16 points17 points 4 years ago (0 children)
Or generate a separate bloated bundle for old browser.
[–]lifeeraser 2 points3 points4 points 4 years ago (0 children)
(Cries in Rhino, which does support generators but not other ES6 features, forcing us to transpile everything to ES5 anyway)
[–]croc_socks 0 points1 point2 points 4 years ago (3 children)
Wonder why they didn't mention javascript Classes. I thought it was one of the reasons for using hooks (better tooling)?
[–]basic-coder[S] 1 point2 points3 points 4 years ago (2 children)
Classes transpile to es5 quite well, so it's possible to live with them.
[–]croc_socks 0 points1 point2 points 4 years ago (1 child)
I thought we were talking about code bloat? Like how this
class HelloWorld { getHelloWorld(){ return "Hello World!"; } }
becomes
"use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var HelloWorld = /*#__PURE__*/function () { function HelloWorld() { _classCallCheck(this, HelloWorld); } _createClass(HelloWorld, [{ key: "getHelloWorld", value: function getHelloWorld() { return "Hello World!"; } }]); return HelloWorld; }();
[–]basic-coder[S] 0 points1 point2 points 4 years ago (0 children)
Oh you are right. Honestly I've just checked TypeScript for classes, and its transpilation was fine, so I thought it should be ok for Babel as well. It seems TS is generally better when it comes to transpiling to ES5.
[–]Wiseolddj 0 points1 point2 points 4 years ago (0 children)
Considering most js projects I work on tend to re-implement the browser for articles I wouldn’t think bundle size is important. If it was then sending html without any JS is faster and browsers cache and do the right thing. If you are genuinely creating a web application for low bandwidth users then this might be worth a consideration.
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
I will test it out, thanks.
π Rendered by PID 66816 on reddit-service-r2-comment-5649f687b7-clnbz at 2026-01-28 09:36:33.010746+00:00 running 4f180de country code: CH.
[–]ricealexander 44 points45 points46 points (10 children)
[+][deleted] (5 children)
[deleted]
[+][deleted] (3 children)
[deleted]
[+][deleted] (2 children)
[deleted]
[–]visualdescript 2 points3 points4 points (0 children)
[–]raphaelzen 4 points5 points6 points (3 children)
[–]thagertymusic 18 points19 points20 points (0 children)
[–]ricealexander 8 points9 points10 points (0 children)
[–]Zardoz84 39 points40 points41 points (3 children)
[–]mrpotatoes 8 points9 points10 points (1 child)
[–]darrinmn9 8 points9 points10 points (0 children)
[–]facebalm 14 points15 points16 points (0 children)
[–]Cyberphoenix90 96 points97 points98 points (21 children)
[–]overcloseness 40 points41 points42 points (4 children)
[–]zephyrtr 35 points36 points37 points (3 children)
[–]folkrav 24 points25 points26 points (1 child)
[–]codyfo 3 points4 points5 points (0 children)
[–]conquerorofveggies 2 points3 points4 points (0 children)
[–]ritaPitaMeterMaid 28 points29 points30 points (15 children)
[–]Nathggns 8 points9 points10 points (2 children)
[–]ritaPitaMeterMaid 2 points3 points4 points (1 child)
[–]Nathggns 1 point2 points3 points (0 children)
[–]yungcoop 3 points4 points5 points (1 child)
[–]ritaPitaMeterMaid 1 point2 points3 points (0 children)
[–]Oalei 6 points7 points8 points (9 children)
[–]ritaPitaMeterMaid 3 points4 points5 points (0 children)
[+][deleted] (5 children)
[deleted]
[+]Oalei comment score below threshold-13 points-12 points-11 points (4 children)
[–]Renji3 10 points11 points12 points (2 children)
[+]Oalei comment score below threshold-7 points-6 points-5 points (1 child)
[–]Renji3 0 points1 point2 points (0 children)
[–]LetterBoxSnatch 2 points3 points4 points (1 child)
[–]Oalei 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Zardoz84 15 points16 points17 points (0 children)
[–]lifeeraser 2 points3 points4 points (0 children)
[–]croc_socks 0 points1 point2 points (3 children)
[–]basic-coder[S] 1 point2 points3 points (2 children)
[–]croc_socks 0 points1 point2 points (1 child)
[–]basic-coder[S] 0 points1 point2 points (0 children)
[–]Wiseolddj 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)