Minify throws TypeError when minifying if with return statement in it.
See original GitHub issueDescribe the bug
Hi everyone, i’m using @babel/core 7.6.0 and babel-minify 0.5.1 and i got TypeError, trying minifying code provided below:
To Reproduce
Minimal code to reproduce the bug
function foo(bar) {
if (bar) {
return 'baz';
}
}
Actual Output
TypeError: unknown: Cannot set property inList of [object Object] which has only a getter
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ring-react-components@1.12.2 test-minify: `minify ./src/components/ActionsBox.js --outFile mActionBox.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ring-react-components@1.12.2 test-minify script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
How are you using babel-minify
minify ./src/components/ActionsBox.js --outFile mActionBox.js
{
plugins: [],
presets: []
}
Possible solution
Error is somewhere in babel-plugin-minify-simplify, when i disable this plugin minifying works, but i cant do that for every dependency and i think that minifying should just work for that case.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:14
Top Results From Across the Web
When reading minified Javascript, how am I supposed to read ...
I understand how the comma operator 'runs a series of expressions, in order, and then returns the result of the last of them'...
Read more >Terser vs. Uglify vs. babel-minify: Comparing JavaScript ...
Terser is one of the most popular and efficient libraries for minifying ES6 code. See how Terser compares to UglifyJS and babel-minify.
Read more >eval() - JavaScript - MDN Web Docs - Mozilla
Throws any exception that occurs during evaluation of the code, including SyntaxError if script fails to be parsed as a script. Description.
Read more >CoffeeScript
ast , boolean: if true, return an abstract syntax tree of the input CoffeeScript source code. Transpilation. CoffeeScript 2 generates JavaScript that uses...
Read more >uglify-js - npm
UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. ... `bare_returns` Allow return outside of functions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This started happening to us since yesterday noon. Still digging into any library dependency update that might cause this.
Looks like we got a fix!