minify icon indicating copy to clipboard operation
minify copied to clipboard

Babel minifier does not set `arguments` properly

Open babel-bot opened this issue 6 years ago • 0 comments

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

Bug Report

Current Behavior I'm using the following source code.

const max = (...values) => Math.max(...values);

When transpiled with minification enabled, it outputs this.

"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

babel-bot avatar Mar 28 '19 02:03 babel-bot