Skip to content

[Bug]: Destructuring empty string to array causes runtime error #13421

@xiaody

Description

@xiaody

💻

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

let [a] = '';
console.log(a);

Configuration file name

No response

Configuration

No response

Current and expected behavior

repl

current

VM104:58 Uncaught TypeError: _i.call is not a function
at _iterableToArrayLimit (:47:18)
at _slicedToArray (:6:5)
at :69:11

expected

Console outputs undefined.

Environment

System:
OS: macOS 11.3.1
Binaries:
Node: 14.16.0 - ~/.nvm/current/bin/node
Yarn: 1.22.10 - ~/.nvm/current/bin/yarn
npm: 6.14.11 - ~/.nvm/current/bin/npm
Monorepos:
Yarn Workspaces: 1.22.10
npmPackages:
@babel/core: ^7.13.8 => 7.14.3
babel-loader: ^8.2.2 => 8.2.2
eslint: ^7.10.0 => 7.27.0

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

good first issueoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions