Incorrect minify-empty-function?
See original GitHub issueWhy is foo(emptyFunction('how long', '?'));
minified to foo(false)
?
Is this test not final/functional? https://github.com/amasad/babel-minify/blob/0a37687f01fefeacace653d7537e132b386b79f3/packages/babel-plugin-minify-empty-function/__tests__/empty-function-test.js#L12
And where does this emptyFunction
come from? It looks like it’s noop
inserted by other plugins, but its usage might be confusing for direct users.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top Results From Across the Web
[Feature] Minify away function calls to empty functions #290
esbuild ex.js --define:__DEV__=false --minify function ... as for this issue, it seems safe to eliminate calls to empty functions and/or ...
Read more >babel-plugin-minify-empty-function - npm
This is mostly a Facebook-specific transform that removes noop function calls. However, can be generalized to detect and remove noops.
Read more >How to check if minification went wrong? - Stack Overflow
1 Answer 1 · Go to the Sources panel and selected your desired script from the scripts list. · Next, press the "Pretty...
Read more >minify css and calc function broken - WordPress.org
i counted 41 calc() method calls in my CSS and that was the only one which got corrupted. So maybe its because its...
Read more >rollup.js
Empty Import. Load the module code, but don't make any new objects available. import './module.js';. This is useful for polyfills, or when the...
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
I’m still confused about the specificity of this transform. Verifying only the name makes it unsafe
This:
would still transformed to:
It should probably test whether the function is actually a noop, or possible evaluate/resolve it properly like CC does
This is a copy from the internal FB transform which I believe does transform it to
false
if it’s part of larger expression. Agree that it doesn’t make much sense outside of FB. If this can be implemented via the replace plugin then great.