Skip to content
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

remove proposals polyfills from default import [skip ci] #8440

merged 1 commit into from Aug 9, 2018


Copy link

@hzoo hzoo commented Aug 8, 2018

Q                       A
Fixed Issues? Fixes #8416
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

The default import is replaced with only polyfills that are Stage 4, instead of also including the Stage < 4 polyfills. This should be in alignment with how we have removed the Stage presets. This also would mean we would need to add new imports when necessary.

And it sounds like we desire to also add the polyfill proposals individually? There's a maintenance cost to that too (not that bad) but then I wonder why we aren't just linking to the polyfill to use (that would just mean removing babel/polyfill as a package, as people may want to use other polyfills too) since we are just aliasing it. So do we really want to do this?

For the proposals in v2:

```js // require('../modules/es7.array.includes'); require('../modules/es7.array.flat-map'); require('../modules/es7.array.flatten'); require('../modules/'); // require('../modules/es7.string.pad-start'); // require('../modules/es7.string.pad-end'); require('../modules/es7.string.trim-left'); require('../modules/es7.string.trim-right'); require('../modules/es7.string.match-all'); // require('../modules/es7.symbol.async-iterator'); require('../modules/es7.symbol.observable'); // require('../modules/es7.object.get-own-property-descriptors'); // require('../modules/es7.object.values'); // require('../modules/es7.object.entries'); require('../modules/es7.object.define-getter'); require('../modules/es7.object.define-setter'); require('../modules/es7.object.lookup-getter'); require('../modules/es7.object.lookup-setter'); require('../modules/'); require('../modules/'); require('../modules/'); require('../modules/es7.set.of'); require('../modules/es7.weak-map.of'); require('../modules/es7.weak-set.of'); require('../modules/'); require('../modules/es7.set.from'); require('../modules/es7.weak-map.from'); require('../modules/es7.weak-set.from'); require('../modules/'); require('../modules/'); require('../modules/'); require('../modules/es7.math.clamp'); require('../modules/es7.math.deg-per-rad'); require('../modules/es7.math.degrees'); require('../modules/es7.math.fscale'); require('../modules/es7.math.iaddh'); require('../modules/es7.math.isubh'); require('../modules/es7.math.imulh'); require('../modules/es7.math.rad-per-deg'); require('../modules/es7.math.radians'); require('../modules/es7.math.scale'); require('../modules/es7.math.umulh'); require('../modules/es7.math.signbit'); // require('../modules/es7.promise.finally'); require('../modules/es7.promise.try'); require('../modules/es7.reflect.define-metadata'); require('../modules/es7.reflect.delete-metadata'); require('../modules/es7.reflect.get-metadata'); require('../modules/es7.reflect.get-metadata-keys'); require('../modules/es7.reflect.get-own-metadata'); require('../modules/es7.reflect.get-own-metadata-keys'); require('../modules/es7.reflect.has-metadata'); require('../modules/es7.reflect.has-own-metadata'); require('../modules/es7.reflect.metadata'); require('../modules/es7.asap'); require('../modules/es7.observable'); ```

from logan:

// Stage 3
import "core-js/fn/string/trim-left";
import "core-js/fn/string/trim-right";
import "core-js/fn/string/match-all";
import "core-js/fn/array/flat-map";
import "core-js/fn/array/flatten";  // RENAMED
import "core-js/fn/global";

// Stage 1
import "core-js/fn/symbol/observable";
import "core-js/fn/promise/try";
import "core-js/fn/observable";

// Stage 1 Math Extensions
import "core-js/fn/math/clamp";
import "core-js/fn/math/deg-per-rad";
import "core-js/fn/math/degrees";
import "core-js/fn/math/fscale";
import "core-js/fn/math/iaddh";
import "core-js/fn/math/isubh";
import "core-js/fn/math/imulh";
import "core-js/fn/math/rad-per-deg";
import "core-js/fn/math/radians";
import "core-js/fn/math/scale";
import "core-js/fn/math/umulh";
import "core-js/fn/math/signbit";

// Stage 1 "of and from on collection constructors"
import "core-js/fn/map/of";
import "core-js/fn/set/of";
import "core-js/fn/weak-map/of";
import "core-js/fn/weak-set/of";
import "core-js/fn/map/from";
import "core-js/fn/set/from";
import "core-js/fn/weak-map/from";
import "core-js/fn/weak-set/from";

// Stage 0
import "core-js/fn/string/at";

// Nonstandard
import "core-js/fn/object/define-getter";
import "core-js/fn/object/define-setter";
import "core-js/fn/object/lookup-getter";
import "core-js/fn/object/lookup-setter";
// import "core-js/fn/map/to-json"; // Not available standalone
// import "core-js/fn/set/to-json"; // Not available standalone

import "core-js/fn/system/global";
import "core-js/fn/error/is-error";
import "core-js/fn/asap";

// Decorator metadata? Not sure of stage/proposal
import "core-js/fn/reflect/define-metadata";
import "core-js/fn/reflect/delete-metadata";
import "core-js/fn/reflect/get-metadata";
import "core-js/fn/reflect/get-metadata-keys";
import "core-js/fn/reflect/get-own-metadata";
import "core-js/fn/reflect/get-own-metadata-keys";
import "core-js/fn/reflect/has-metadata";
import "core-js/fn/reflect/has-own-metadata";
import "core-js/fn/reflect/metadata";


var a = ["core-js/fn/string/trim-left",

const fse = require('fs-extra');

Promise.all( => {
	return fse.outputFile(`${file.slice(11)}.js`, `import "${file}";`)
	.catch((error) => {
Copy link

@babel-bot babel-bot commented Aug 9, 2018

Build successful! You can test your changes in the REPL here:

@hzoo hzoo force-pushed the rm-proposals-in-polyfill branch from 2e23a24 to 4d89c12 Aug 9, 2018
@hzoo hzoo added this to the Babel 7 RC milestone Aug 9, 2018
@hzoo hzoo merged commit c8bb450 into master Aug 9, 2018
3 of 4 checks passed
3 of 4 checks passed
continuous-integration/travis-ci/pr The Travis CI build is in progress
babel/repl REPL preview is available
ci/circleci Your tests passed on CircleCI!
continuous-integration/travis-ci/push The Travis CI build passed
Copy link
Member Author

@hzoo hzoo commented Aug 9, 2018

We should also update polyfill docs and also add this change to the upgrade doc.

@hzoo hzoo deleted the rm-proposals-in-polyfill branch Aug 9, 2018
Copy link

@stnwk stnwk commented Aug 21, 2018

So, how do we include polyfills for @babel/plugin-proposal-x now? There is no documentation for this yet + the blog post is too unspecific :/

Any input would be great! @hzoo

Copy link

@nicolo-ribaudo nicolo-ribaudo commented Aug 21, 2018

You should import then directy from the core-js package.


import "core-js/fn/array/flatMap";
Copy link
Member Author

@hzoo hzoo commented Aug 21, 2018

Ok I updated it a bit as well babel/website@3db6772

Copy link

@stnwk stnwk commented Aug 21, 2018

Awesome, thank you both!

facebook-github-bot added a commit to magma/magma that referenced this pull request May 14, 2019
This diff is fixing the UI on old Chrome versions / IE. Apparently Array.flat is not included in babel plyfill and need to be included manually - see:

Reviewed By: elys1um

Differential Revision: D15334182

fbshipit-source-id: f7704a898ede36a8352b916771574dbba8721f22
@lock lock bot added the outdated label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.