babel / babel/minify

inferred unused function names are not removed

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

Description

**Describe the bug**

Follow up of #842 -

Function names created by function name transformer of es2015 aren't removed when unused.

**To Reproduce**

Minimal code to reproduce the bug

```js
function foo() {
return {
a() {}
}
}
```

**Actual Output**

If there is no Error thrown,

```js
function foo() {
return {
a: function b() {}
};
}
```

**Expected Output**

```js
function foo() {
return {
a: function() {}
};
}
```

**Configuration**

`babel-minify-cli`

babel-minify version: master after #841

babel version : `7.0.0-beta.46`

babel-minify-config:

```json5
{
removeConsole: true,
keepFnNames: true
}
```

babelrc:

```json5
{
plugins: [],
presets: []
}
```

**Possible solution**

Apply the same fix as in #842 - force register the binding (because this binding has been skipped by babel)

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.