Issue 1:
Hi

I have a problem with "async" in babel and node js that i couldn't solve for days... the error bellow:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\BOOSTACKSTICK\BOOSTACK\node_modules\@babel\runtime\helpers\esm\asyncToGenerator.js
[1] require() of ES modules is not supported.
[1] require() of C:\BOOSTACKSTICK\BOOSTACK\node_modules\@babel\runtime\helpers\esm\asyncToGenerator.js from C:\BOOSTACKSTICK\BOOSTACK\prod-server\api\auth\auth-controller.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
[1] Instead rename asyncToGenerator.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\BOOSTACKSTICK\BOOSTACK\node_modules\@babel\runtime\helpers\esm\package.json.

I compile my dev-server folder to a prod-server with config bellow

package.json

"scripts": {
"serve": "vue-cli-service serve",
"build": "babel dev-server --out-dir prod-server && vue-cli-service build",
"lint": "vue-cli-service lint",
"dev": "concurrently \"babel dev-server --out-dir prod-server --watch\" \"nodemon prod-server/index.js\" \"npm run serve\" "
},

"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/node": "^7.12.1",
"@babel/plugin-transform-async-to-generator": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/runtime-corejs3": "^7.12.1",
"@vue/cli-plugin-babel": "^4.5.8",
"@vue/cli-plugin-eslint": "^4.5.8",
"@vue/cli-service": "^4.5.8",
"babel-eslint": "^10.1.0",
"compass-mixins": "^0.12.10",
"concurrently": "^5.3.0",
"core-js": "^3.6.5",
"css-loader": "^3.6.0",
"eslint": "^5.16.0",
},

.babelrc

{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage", // or "entry"
"corejs": 3,
"targets": {
"node": "current"
}
}
]
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 3
}
],
["@babel/plugin-proposal-class-properties"]
]
}

Environment

Node: v12.16.3
Babel: 7.12.3

Simple code with "async" that causing a problem

//Check And Validate Request (LOGIN METHODE)
export async function index(req, res) {
return res.status(200).json({ user: "user" });
}

** OutPut Babel**

"use strict";

var _interopRequireDefault = require("C:/BOOSTACKSTICK/BOOSTACK/node_modules/@babel/runtime/helpers/interopRequireDefault");

var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");

_Object$defineProperty(exports, "__esModule", {
value: true
});

exports.index = index;

var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));

require("regenerator-runtime/runtime");

var _asyncToGenerator2 = _interopRequireDefault(require("C:/BOOSTACKSTICK/BOOSTACK/node_modules/@babel/runtime/helpers/esm/asyncToGenerator"));

//Check And Validate Request (LOGIN METHODE)
function index(_x, _x2) {
return _index.apply(this, arguments);
}

function _index() {
_index = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(req, res) {
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", res.status(200).json({
user: "user"
}));

case 1:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _index.apply(this, arguments);
}

Possible Solution

the only workaround i tested to avoid this error is to modify manually the node_modules\@babel\runtime\helpers\esm\package.json to remove "type": module and remove import from node_modules\@babel\runtime\helpers\esm\asyncToGenerator.js

is it a bug or i'm doing something wrong?

Thank you in advance for your reply.

Issue 2:
Issue originally reported by @aweary in babel/babel-preset-env#294

This started from a conversation stemming from this tweet: https://twitter.com/aweary/status/853771117894545408

@hzoo, @JakeChampion and I met today and had a quick discussion about how we could make babel-preset-env integrate with https://polyfill.io/. The rough plan we agreed upon was:

Move the use-built-ins plugin into a standalone package

Expose an option to write the list of features requiring a polyfill to disk, instead of including the default core-js imports.

This would allow users to read the feature list at build time and include the appropriate polyfill.io link, which uses a query string to communicate which polyfills should be included.

This approach makes polyfill.io integration very easy, but it will also open up new ways for community build tools to fulfill polyfill requirements at build time.