Issue 1:
💻

Would you like to work on a fix?

How are you using Babel?

rollup-plugin-babel

Input code

I rollup the following code

function getRandomString(len) {
let s = ''
while (s.length < len)
s += Math.random().toString(36).substr(2, len - s.length)
return s
}

it converted to

function getRandomString(e) {
for (var n = ""; n.length < e;) {
n += Math.random().toString(36).substr(2, e - n.length);
}

return s;
}

Configuration file name

No response

Configuration

export default {
input: './index.js',
plugins: [
babel({
"presets": [
"@babel/preset-env",
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining"
]
}),
// uglify(),
],
output: [
{file: './dist/bundle.min.js', name: "Ingrow", format: 'iife'},
{file: './dist/index.js', exports: "default", format: 'cjs' }
]
}

Current and expected behavior

to give something that doesn't make error

now its made Uncaught ReferenceError: s is not defined

Environment

"@babel/cli": "^7.14.5",

"rollup": "^2.52.2",

node version: v12.18.3

Possible solution

No response

Additional context

No response

Issue 2:
Bug Report

Current Behavior

I have upgraded from babel 6.25.0 to @babel/core 7.0.0 by using the babel-upgrade --write comand.

I am using webpack and babel together. I am able to run webpack-dev-server fine after the upgrade. When I attempt to start my app in prod and run my build command, the build immediately fails pointing to @babel/core within babel-loader with this error:

ERROR in ./src/index.jsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: Invalid value used as weak map key
at WeakMap.set (<anonymous>)
at loadCachedDescriptor (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/config-descriptors.js:84:20)
at createPluginDescriptors.map.desc (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/config-descriptors.js:63:108)
at Array.map (<anonymous>)
at alias (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/config-descriptors.js:63:96)
at cachedFunction (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/caching.js:33:19)
at plugins.plugins (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/config-descriptors.js:28:77)
at mergeChainOpts (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/config-chain.js:319:26)
at /Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/config-chain.js:283:7
at buildRootChain (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/config-chain.js:68:29)
at loadPrivatePartialConfig (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/partial.js:85:55)
at loadFullConfig (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/config/full.js:43:39)
at process.nextTick (/Users/tjohnson/Public/repos/api-manager-web/node_modules/@babel/core/lib/transform.js:28:33)
at process._tickCallback (internal/process/next_tick.js:61:11)

I have spent a long time looking for similiar issues, opened a question on SO, and unfortunately I have not had any luck resolving this. Thank you for the help.

Expected behavior/code

I expect to be able to run my build command and bundle my app for prod.

Babel Configuration (.babelrc, package.json, cli command)

{
"presets": ["@babel/preset-env", "@babel/preset-react", "react-app"],
"env": {
"development": {
"plugins": ["react-hot-loader/babel"]
},
"test": {
"plugins": [
["webpack-alias", { "config": "./build_config/webpack.common.js" }],
"istanbul",
"dynamic-import-node"
]
},
"production": {
"plugins": [
"transform-react-remove-prop-types",
["recharts", null],
["react-hot-loader/babel", null]
]
}
}
}

package.json devDependencies

"devDependencies": {
"@babel/core": "7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-react": "^7.0.0",
"autoprefixer": "^7.1.2",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.5",
"babel-plugin-istanbul": "^5.0.1",
"babel-plugin-recharts": "^1.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.6",
"babel-preset-react-app": "^8.0.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"copy-webpack-plugin": "^5.0.3",
"copyfiles": "^2.1.0",
"cross-env": "^5.0.1",
"css-loader": "^2.1.1",
"dotenv": "^8.0.0",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.6.0",
"eslint": "^5.15.3",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.1.0",
"eslint-import-resolver-webpack": "^0.10.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.11.0",
"eslint-plugin-react-hooks": "^1.0.1",
"eslint-plugin-testcafe": "^0.2.1",
"extract-text-webpack-plugin": "^4.0.0-alpha.0",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"jsdom": "9.0.0",
"mocha": "^5.2.0",
"mocha-duplicate-reporter": "^0.2.1",
"mocha-jenkins-reporter": "^0.4.0",
"mocha-multi": "^0.11.0",
"mocha-sonar-generic-test-coverage": "0.0.3",
"node-sass": "^4.9.3",
"null-loader": "^1.0.0",
"nyc": "^13.0.1",
"postcss-loader": "^2.0.6",
"preload-webpack-plugin": "^2.3.0",
"process-finder": "1.0.0",
"react-hot-loader": "^4.8.4",
"redux-mock-store": "^1.2.2",
"retire": "^2.0.2",
"rimraf": "^2.5.4",
"sass-loader": "^6.0.6",
"script-ext-html-webpack-plugin": "^2.1.3",
"semver": "^5.3.0",
"simple-mock": "^0.7.3",
"sinon": "^7.2.2",
"style-loader": "^0.20.2",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.0.0",
"testcafe": "^1.0.0",
"tree-kill": "1.2.0",
"url-join": "^4.0.0",
"url-loader": "^1.1.2",
"weakmap-polyfill": "^2.0.0",
"webpack": "^4.30.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.1",
"webpack-dev-middleware": "^3.6.2",
"webpack-dev-server": "^3.3.1",
"webpack-merge": "^4.2.1"
},

cli commands:

"prebuild": "rm -rf dist",
"all": "npm run build && npm run lint && npm run test",
"build": "npm run build:dist",
"build:copy": "copyfiles -f ./public/favicon.ico ./dist && copyfiles -f ./public/authzconfiguration.tpl.js ./dist",
"build:dist": "npm run build:copy && cross-env NODE_ENV=production webpack -p --env=prod --progress --colors",
"start": "webpack-dev-server --progress --colors --env=dev",

Environment

Babel version(s): 7.0.0

Node/npm version: Node v10.15.0 - npm 6.7.0:

OS: OSX 10.14.3

Monorepo: no

How you are using Babel: loader/webpack

Possible Solution

I have looked at my dependencies, and I have several packages that depend on babel v6.xx. This may relate to it, but I am not sure

Additional context/Screenshots