error minifying class with env set to target IE 11
- Dominant language
- JavaScript
- Stars
- 4.4k
- Forks
- 217
- PR merge metrics
- No merged PRs in 30d
Description
When targetting IE11 with preset-env _and_ minifying, an error occurs.
Does _not_ occur when I minify the output of preset-env.
**To Reproduce**
```js
(function () {
let local = {};
class Class {
constructor() {
}
}
return Class;
})();
```
**Stack Trace**
```
TypeError: repro.js: Cannot read property 'end' of null
at _evaluate (C:\dev\examples\babel\node_modules\babel-traverse\lib\path\evaluation.js:159:58)
at evaluate (C:\dev\examples\babel\node_modules\babel-traverse\lib\path\evaluation.js:65:17)
at NodePath.evaluate (C:\dev\examples\babel\node_modules\babel-traverse\lib\path\evaluation.js:41:15)
at evaluateIdentifier (C:\dev\examples\babel\node_modules\babel-helper-evaluate-path\lib\index.js:127:15)
at evaluate (C:\dev\examples\babel\node_modules\babel-helper-evaluate-path\lib\index.js:19:12)
at isPureAndUndefined (C:\dev\examples\babel\node_modules\babel-plugin-transform-remove-undefined\lib\index.js:26:22)
at PluginPass.ReturnStatement (C:\dev\examples\babel\node_modules\babel-plugin-transform-remove-undefined\lib\index.js:157:15)
at newFn (C:\dev\examples\babel\node_modules\babel-traverse\lib\visitors.js:276:21)
at NodePath._call (C:\dev\examples\babel\node_modules\babel-traverse\lib\path\context.js:76:18)
at NodePath.call (C:\dev\examples\babel\node_modules\babel-traverse\lib\path\context.js:48:17)
```
**Configuration**
Using these packages:
```
"babel-core": "~6.26.3"
"babel-preset-env": "~1.7.0"
"babel-preset-minify": "~0.4.3"
```
Enable `preset-env` (for IE11), `mergeVars`, and `removeUndefined` in .babelrc:
```json
{
"presets": [
["env", {
"targets": {
"ie": "11"
}
}],
["minify", {
"booleans": false,
"builtIns": false,
"consecutiveAdds": false,
"deadcode": false,
"evaluate": false,
"flipComparisons": false,
"guards": false,
"infinity": false,
"mangle": false,
"memberExpressions": false,
"mergeVars": true,
"numericLiterals": false,
"propertyLiterals": false,
"regexpConstructors": false,
"removeConsole": false,
"removeDebugger": false,
"removeUndefined": true,
"replace": false,
"simplify": false,
"simplifyComparisons": false,
"typeConstructors": false,
"undefinedToVoid": false
}]
]
}
```
Contributor guide
Assessment
This issue has not been assessed yet.