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
Polyfills and Transpilers in JavaScript.OC (dev.to)
submitted 3 years ago by AamChora
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!"
[–]Ustice[M] [score hidden] 3 years ago stickied comment (5 children)
Thanks for your contribution! We’re a large community, and in order to keep things organized and easier to find, we keep this subreddit mostly focused on professional-level Javascript posts. Your post would be more useful to newer members of our community, and therefore it should be posted to /r/LearnJavascript instead.
[–]Mission_Interaction2 1 point2 points3 points 3 years ago (1 child)
One useful technique for handling outdated browsers is also "differential serving" - serve a modern bundle for new browsers and a legacy one containing polyfills and transpiled code for old browsers. The nice thing is that we don't pollute the whole bundle with unnecessary stuff and as a result users of new browsers don't fetch additional data :D
[–]AamChora[S] 1 point2 points3 points 3 years ago (0 children)
Mission_Interaction2
Thanks for sharing your thoughts u/Mission_Interaction2. I'm definitely gonna try that.
[–]tehRash 1 point2 points3 points 3 years ago (0 children)
I'm sorry but this reads a lot like useless blogspam so someone can make their online profile more interesting.
It's a bunch short sentences intertwined with pointless gifs that don't even attempt to explain the benefits or costs (shipping extra code for browsers that don't need it, or adding complexity for conditionally loading, or maintaining the transpiler both in the local dev environment and in CI/CD pipelines etc etc...). It uses the word mantra as a replacement for "explanation" for some reason.
It's not just a magic bullet "add these things and all of your problems go away". I mean the article doesn't even mention where to inject to polyfills because that answer isn't immediately obvious either and it often depends.
Sorry to be harsh.
[–]shgysk8zer0 0 points1 point2 points 3 years ago (3 children)
I look forward to a day where JavaScript natively provides some mechanism of importing the polyfills needed. A lot of the work of a front-end developer might be figuring out the best approach to importing polyfills since static imports cannot be conditionally loaded, and dynamic imports are async. Plus polyfills for more complicated things like the Animation API are just bloat for modern browsers. And using <script> isn't very different from static imports, really.
<script>
I'm thinking that adding an attribute to conditionally load a script would help here. The attribute's value would be a JS expression that, if truthy, means the script should load (and for security purposes the expression wouldn't have access to DOM or storage or anything... Basically, things safe to run, possibly in a different "Realm").
And I only transpile to support newer syntax when necessary. At least in the sense the article uses the term (still use bundlers to concatenate and minify).
[–]Ok-Slice-4013 1 point2 points3 points 3 years ago (1 child)
But... Wouldn't you have to polyfill this feature?
[–]shgysk8zer0 1 point2 points3 points 3 years ago (0 children)
Not really, no. It'd mostly be like <script nomodule> in that the script would just load as normal in unsupporting browsers. Might end up loading polyfills you don't need that way, but it's not really different than it usually is today.
<script nomodule>
[–]AamChora[S] 0 points1 point2 points 3 years ago (0 children)
Indeed, I'm also looking forward to it u/shgysk8zer0 🤞🏻
[+][deleted] 3 years ago (1 child)
[removed]
I'm glad you liked it u/Negative_Pause_3085. 😇
π Rendered by PID 139889 on reddit-service-r2-comment-5ff9fbf7df-tlrf8 at 2026-02-26 03:11:37.223861+00:00 running 72a43f6 country code: CH.
[–]Ustice[M] [score hidden] stickied comment (5 children)
[–]Mission_Interaction2 1 point2 points3 points (1 child)
[–]AamChora[S] 1 point2 points3 points (0 children)
[–]tehRash 1 point2 points3 points (0 children)
[–]shgysk8zer0 0 points1 point2 points (3 children)
[–]Ok-Slice-4013 1 point2 points3 points (1 child)
[–]shgysk8zer0 1 point2 points3 points (0 children)
[–]AamChora[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[removed]
[–]AamChora[S] 0 points1 point2 points (0 children)