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
[Meta] Known issues for the minifier #2934
Comments
While looking at the benchmark, I found that I found that
|
Seems like swc is exponentially slower than esbuild when input size increases. |
I think the analyzer is the problem. But there are much more rules than |
Misalignment between terser and swc default options
However simply enable them would likely to cause lots of bugs. |
As google closure compiler ranks #1 in compress react, I diffed the output artifact with swc and found some abilities even terser doesn't have:
function getComponentName(type) {
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_BLOCK_TYPE:
return getComponentName(type._render);
case REACT_LAZY_TYPE:
{
try {
return getComponentName(init(payload));
} catch (x) {
return null;
}
}
}
}
return null;
} can be transformed into function getComponentName(type) {
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_BLOCK_TYPE:
return getComponentName(type._render);
case REACT_LAZY_TYPE:
{
try {
return getComponentName(init(payload));
} catch (x) {
}
}
}
}
return null;
}
function getWrappedName(outerType, innerType, wrapperName) {
var functionName = innerType.displayName || innerType.name || '';
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
} compressed into function getWrappedName(c, a, b) {
a = a.displayName || a.name || "";
return c.displayName || ("" !== a ? b + "(" + a + ")" : b);
}
function describeFunctionComponentFrame(fn, source, ownerFn) {
{
return describeNativeComponentFrame(fn, false);
}
} would be inlined |
Thank you so much! |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Rules to port from google closure compiler
defaults
We have to enable
by default
Rules to implement
Promise.resolve
If it's immediately resolved, we can drop some nodes.
The text was updated successfully, but these errors were encountered: