HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
babel
babel-preset-env
JavaScript2016–2017
babel / babel-preset-env · Archived

babel-preset-env

PSA: this repo has been moved into babel/babel -->

3Distinct people
16Mentions
0Explicit recommenders
3.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

PSA: this repo has been moved into babel/babel -->

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 9–Nov 16 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/16/2026, 1:56:48 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by month16 dated mentions

Observed mentions: 2016-10-18 19:09:39 UTC to 2017-07-11 19:03:29 UTC.

0123452016-10-01 00:00:00 UTC to 2016-11-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 commentsOct 20162016-11-01 00:00:00 UTC to 2016-12-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-12-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments2017-01-01 00:00:00 UTC to 2017-02-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-02-01 00:00:00 UTC to 2017-03-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 commentsFeb 20172017-03-01 00:00:00 UTC to 2017-04-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-04-01 00:00:00 UTC to 2017-05-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-05-01 00:00:00 UTC to 2017-06-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-06-01 00:00:00 UTC to 2017-07-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-07-01 00:00:00 UTC to 2017-08-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsJul 2017

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Oct 20162016-10-01 00:00:00 UTC2016-11-01 00:00:00 UTC404
Nov 20162016-11-01 00:00:00 UTC2016-12-01 00:00:00 UTC101
Dec 20162016-12-01 00:00:00 UTC2017-01-01 00:00:00 UTC514
Jan 20172017-01-01 00:00:00 UTC2017-02-01 00:00:00 UTC000
Feb 20172017-02-01 00:00:00 UTC2017-03-01 00:00:00 UTC303
Mar 20172017-03-01 00:00:00 UTC2017-04-01 00:00:00 UTC000
Apr 20172017-04-01 00:00:00 UTC2017-05-01 00:00:00 UTC000
May 20172017-05-01 00:00:00 UTC2017-06-01 00:00:00 UTC101
Jun 20172017-06-01 00:00:00 UTC2017-07-01 00:00:00 UTC101
Jul 20172017-07-01 00:00:00 UTC2017-08-01 00:00:00 UTC101

What Hacker News says

5 sources
Might be a good chance to suggest using our new preset: https://github.com/babel/babel-preset-env/. TL;DR - automate your Babel config options based on targets. babel-preset-env: A Babel preset that can automatically determine the Babel plugins and polyfills you need based on your supported environments. It takes the data from compat-table [1] to generate a mapping [2] between a Babel plugin and the first version that a browser/env supports. We calculate the least common denominator of your targeted envs to determine the final set of plugins to compile with. (Feel free to ask questions, I help maintain Babel and the preset). Just released a 1.0 a few weeks ago and looking for more help and usage! Looking into more help with removing unnecessary polyfills, and determining plugins based on performance via benchmarks of native/compiled. And
Read the rest
yes there is a lot of work that goes into making this work correctly (and in the foreseeable future with ES2015+). Would appreciate any help moving forward. And maybe we should just replace/recommend this preset instead of anything else to fight the fatigue.. [1]: https://kangax.github.io/compat-table/es6/ [2]: https://github.com/babel/babel-preset-env/blob/master/data/p...
In Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
They're getting better at describing which features are shimmed, but the easiest way to check is by running a single plugin on a bit of code and seeing for yourself. For instance, I decided just now to check if `transform-object-rest-spread` included an Object.assign polyfill (because spread syntax transpiles to Object.assign behind the scenes.) With the following input: var foo = { x: 1, y: 2 }; var bar = { a: 3, b: 4, ...foo }; var baz = new Promise(function(resolve, reject) { resolve("quux"); }); I get the following output var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var foo = { x: 1, y: 2 }; var bar = _exte
Read the rest
nds({ a: 10, b: 11 }, foo); var baz = new Promise(function(resolve, reject) { resolve("quux"); }); The problem here, (to borrow phrasing from the docs) is that "Babel uses very small helpers for common functions such as _extend. By default this will be added to every file that requires it. This duplication is sometimes unnecessary, especially when your application is spread out over multiple files." To solve this problem, many people use the `transform-runtime` plugin [1] as well. To put it shortly, it replaces inline helper functions (like _extends in the example above) with imports from an adapter module called 'babel-runtime', which itself exposes the relevant polyfills (regenerator[2] and core-js[3]). With `transform-runtime`, I get the following: import _Promise from "babel-runtime/core-js/promise"; import _extends from "babel-runtime/helpers/extends"; var foo = { x: 1, y: 2 }; var bar = _extends({ a: 10, b: 11 }, foo); var baz = new _Promise(function (resolve, reject) { resolve("foo"); }); Notice that the Promise implementation was polyfilled as well. > I didn't know how to tell Babel which browsers I was targeting... You might *really like babel-preset-env[4], a new project they just launched. Basically, you give it a set of browser targets (much like autoprefixer) and it works out exactly which plugins you need to support the latest (currently es2015, I think) version of javascript. Hope that helps! Sorry for going on a Babel-related spiel in a Typescript thread, couldn't help myself. ;) 1: http://babeljs.io/docs/plugins/transform-runtime/#technical-... 2: https://facebook.github.io/regenerator/ 3: https://github.com/zloirock/core-js 4: https://github.com/babel/babel-preset-env
In Announcing TypeScript 2.1

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.