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

core-js definitions are not fully injected with useBuiltIns: usage #2209

Closed
pan93412 opened this issue Sep 5, 2021 · 5 comments · Fixed by #5293
Closed

core-js definitions are not fully injected with useBuiltIns: usage #2209

pan93412 opened this issue Sep 5, 2021 · 5 comments · Fixed by #5293
Labels
Milestone

Comments

@pan93412
Copy link

pan93412 commented Sep 5, 2021

Describe the bug

When using env: mode: "entry" with TypeScript and Promise.any, the output file should include not only promise.any module but also esnext.agregate-error module.

For reference: zloirock/core-js#737 babel/babel#10910

Input code

Promise.any([]);

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false,
      "dynamicImport": false,
      "decorators": false
    },
    "target": "es2015"
  },
  "env": {
    "target": {
      "node": "10"
    },
    "mode": "usage",
    "coreJs": "3.17",
    "shippedProposals": true
  },
  "module": {
    "type": "commonjs"
  },
  "sourceMaps": true
}

Expected behavior

Considering the output file:

"use strict";
require("core-js/modules/es.promise");
require("core-js/modules/es.object.to-string");
require("core-js/modules/esnext.promise.any");
require("core-js/modules/es.string.iterator");
require("core-js/modules/es.array.iterator");
require("core-js/modules/web.dom-collections.iterator");
Promise.any([]);

It should also include require("esnext.agregate-error") according to zloirock/core-js#737.

Version

$ yarn swc --version
yarn run v1.22.11
$ /Users/pan93412/Projects/check_env/node_modules/.bin/swc --version

@swc/cli: 0.1.49
@swc/core: 1.2.84

✨  Done in 0.24s.

Additional context

Thanks a lot! :)

@pan93412 pan93412 added the C-bug label Sep 5, 2021
@zloirock
Copy link

zloirock commented Sep 5, 2021

Built-ins definition should be aligned with babel/babel-polyfills#99

@pan93412
Copy link
Author

pan93412 commented Sep 5, 2021

Built-ins definition should be aligned with babel/babel-polyfills#99

So, should we wait until it got merged?

@pan93412 pan93412 changed the title core-js definitions not fully injected with useBuiltIns: usage core-js definitions are not fully injected with useBuiltIns: usage Sep 5, 2021
@zloirock
Copy link

zloirock commented Sep 5, 2021

Not necessary. In this PR also should be:

  • Removed *.typed-array.* methods from instance dependencies (they are in constructors dependencies)
  • Removed es.reflect.to-string-tag from Symbol.toStringTag dependencies (it's moved to global Reflect)
  • Added IteratorDependencies to instance every, filter, find , flatMap, forEach, map, reduce, some.

@kdy1 kdy1 modified the milestones: v1.2.86, v1.2.87, v1.2.88, v1.2.89 Sep 9, 2021
@kdy1 kdy1 modified the milestones: v1.2.89, v1.2.90, v1.2.91, v1.2.92 Sep 21, 2021
@kdy1 kdy1 modified the milestones: v1.2.92, v1.2.93, v1.2.94 Sep 29, 2021
@kdy1 kdy1 modified the milestones: v1.2.94, v1.2.95, v1.2.96 Oct 8, 2021
@zloirock
Copy link

zloirock commented Oct 9, 2021

babel/babel-polyfills#99 is merged.

@kdy1 kdy1 modified the milestones: v1.2.96, v1.2.97 Oct 13, 2021
@kdy1 kdy1 modified the milestones: v1.2.145, v1.2.146, v1.2.147, v1.2.148 Feb 24, 2022
@kdy1 kdy1 modified the milestones: v1.2.148, v1.2.149, v1.2.150 Mar 4, 2022
@kdy1 kdy1 added this to the Planned milestone Mar 12, 2022
@kdy1 kdy1 modified the milestones: Planned, v1.2.199 Jun 11, 2022
@kdy1 kdy1 modified the milestones: Planned, v1.2.219 Jul 27, 2022
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 16, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

4 participants