-
-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minify throws TypeError when minifying if with return statement in it. #967
Comments
I just run into the same issue after updating my build system, caused by this line: |
If I replace this problematic line, without understanding what I do, but it seems more logical regarding to the code, then it's working:
|
This started happening to us since yesterday noon. Still digging into any library dependency update that might cause this. |
Current lead: |
This issue definitively started from this release 😁 |
Same here. Looking into subdependencies now. Can't find a way to list node packages by release date :/ |
I got this problem after migration from 6.x to 7.x, it works when i use babel-minify, or babel-preset-minify with simplify=false option, also if I rewrite given code: function foo(bar) {
if (bar) {
return "baz";
}
} into: function foo(bar) {
if (bar) return "baz";
} or: function foo(bar) {
let baz = undefined;
if (bar) {
baz = "baz";
};
return baz
} it minifies code without any error. Also if i added some test into packages/babel-plugin-minify-simplify/__tests__/fixtures/if-conditional-return-5/ actual.js function foo(bar) {
if(bar) {
return 'baz';
}
} expected.js function foo() {
if (bar) return 'baz';
} then yarn test it also works. It's is look's like the problem is not with the plugin itself, but something doesn't work if you transpile it with babel, then you try to minify it. I'm running out of ideas right now:( |
What about my patch mentioned above: #967 (comment) |
I just applied it in my repo: cyberbotics/webots#1069 |
The fix appears to be in this commit: babel/babel@0f94999 which hasn't made it into a @hzoo - Can you release a new (Also, unrelated to this bug, but the latest version of |
wow that's great! I'm checking it right now. |
I confirm this is working :-) |
All works, after update to babel-core 7.7.2. Thank you very much for fast fix, you're the best! Since that i'm closing this issue. |
Describe 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
Actual Output
How are you using babel-minify
minify ./src/components/ActionsBox.js --outFile mActionBox.js
Also, can be reproduced in babljs.io: https://babeljs.io/repl/#?babili=true&browsers=&build=&builtIns=false&spec=false&loose=false&code_lz=GYVwdgxgLglg9mABMOcAUAjAhgJwJSIDeAUAJAzCKa4EmL2Kk4CmUIOS2AXgNzEOIAvsUFA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=false&presets=babili&prettier=false&targets=&version=7.7.1&externalPlugins=
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.
The text was updated successfully, but these errors were encountered: