babel / babel/minify

Babel minifier does not set `arguments` properly

Open
#949 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.4k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

Original issue submitted by @GrantGryczan in https://github.com/babel/babel/issues/8511

## Bug Report

**Current Behavior**
I'm using the following source code.
```js
const max = (...values) => Math.max(...values);
```
When transpiled with minification enabled, it outputs this.
```js
"use strict";var max=function(){return Math.max.apply(Math,a)};
```
You can see yourself that `a` is undefined, though it's _supposed_ to be set to `arguments`.
This problem does not occur without minification enabled.

REPL: https://babeljs.io/repl/#?babili=true&browsers=&build=&builtIns=false&spec=false&loose=false&code_lz=MYewdgzgLgBAtgQwB4wLwwBQDocDcEA2ArgKYQCUaAfDALIJQAWWiS2ehpFA3EA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=false&presets=es2015%2Ces2016%2Ces2017%2Creact%2Cstage-0%2Cstage-1%2Cstage-2%2Cstage-3%2Ces2015-loose%2Cbabili&prettier=false&targets=&version=6.26.0&envVersion=1.6.2

**Environment**
- Babel version(s): 6.26.3
- Node/npm version: Node 10.4.0/NPM 6.2.0
- OS: Ubuntu 16.04
- How you are using Babel: programmatically

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.