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

Direct usage of core-js-compat #1604

Closed
zloirock opened this issue Apr 24, 2021 · 4 comments · Fixed by #3968
Closed

Direct usage of core-js-compat #1604

zloirock opened this issue Apr 24, 2021 · 4 comments · Fixed by #3968
Labels
Milestone

Comments

@zloirock
Copy link

As I could see, copy of core-js-compat data used in swc version of preset-env is critically obsolete - 1.5 year. Each new version of core-js-compat contains updates engines support data,

// .swcrc:
{
  "env": {
    "targets": {
      "safari": "14"
    },
    "mode": "entry",
    "coreJs": "3.11"
  }
}
// input.js:
import 'core-js/stable';
// output.js:
import   "core-js/modules/es.typed-array.int32-array";
import   "core-js/modules/es.typed-array.from";
import   "core-js/modules/web.immediate";
import   "core-js/modules/web.url-search-params";
import   "core-js/modules/es.typed-array.uint32-array";
import   "core-js/modules/web.url";
import   "core-js/modules/es.typed-array.float64-array";
import   "core-js/modules/es.typed-array.uint8-array";
import   "core-js/modules/es.typed-array.int16-array";
import   "core-js/modules/es.typed-array.int8-array";
import   "core-js/modules/es.string.replace";
import   "core-js/modules/es.typed-array.uint8-clamped-array";
import   "core-js/modules/es.typed-array.float32-array";
import   "core-js/modules/web.url.to-json";
import   "core-js/modules/es.typed-array.of";
import   "core-js/modules/es.typed-array.uint16-array";
// expected:
import   "core-js/modules/web.immediate";

core-js-compat contains information about new modules and entry points. Without this information impossible to use it correctly - new modules will not be injected even if they are required.

// .swcrc:
{
  "env": {
    "targets": {
      "safari": "13"
    },
    "mode": "entry",
    "coreJs": "3.11"
  }
}
// input.js:
import 'core-js/stable/promise';
// output.js:
import   "core-js/modules/es.promise.finally";
import   "core-js/modules/web.dom-collections.iterator";
// expected:
import   "core-js/modules/es.aggregate-error";
import   "core-js/modules/es.promise.any";
import   "core-js/modules/es.promise.finally";
import   "core-js/modules/web.dom-collections.iterator";

Compat data should be updated even without swc updates for making possible to use actual core-js versions properly, so the only way to do it - usage of core-js-compat as a dependency.

@zloirock zloirock added the C-bug label Apr 24, 2021
@kdy1 kdy1 added this to the v1.2.55 milestone Apr 24, 2021
@kdy1 kdy1 modified the milestones: v1.2.55, v1.2.56, v1.2.57, v1.2.58 May 7, 2021
@zloirock zloirock mentioned this issue May 20, 2021
1 task
@kdy1 kdy1 modified the milestones: v1.2.58, v1.2.59 May 21, 2021
@kdy1 kdy1 modified the milestones: v1.2.59, v1.2.60 May 30, 2021
@kdy1 kdy1 modified the milestones: v1.2.60, v1.2.61 Jun 7, 2021
@zloirock
Copy link
Author

zloirock commented Dec 19, 2021

@kdy1 please, take a look at this since at this moment is used critically obsolete compact data from core-js@3.6 - 2019.12.19 - 2 years old.

@Austaras
Copy link
Member

I don't believe use core-js-compat as a dependency would be a good idea -- it would cause much trouble in wasm. However, I believe it's good to include_str core-js-compat directly since it will always reside in node_modules/core-js-compat. @kdy1 what's your opinion?

@kdy1
Copy link
Member

kdy1 commented Mar 11, 2022

@Austaras I think you are right, it will make updating much easier.

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 17, 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 17, 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