We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
webpack use some strategy to help minifier minimize more bundle size.
// transform foo // unused // into null && foo;
But swc failed to transform this, while it can be minimized without null && foo
null && foo
You can remove comment in line 11
(() => { "use strict"; class Element { } class PointElement extends Element { static id = 'point'; constructor(cfg) { super(); } } // var chart_elements = /*#__PURE__*/ Object.freeze({ // PointElement: PointElement // }); var chart_elements = /*#__PURE__*/(null && (Object.freeze({ PointElement: PointElement }))); const registerables = null && ([ chart_elements, chart_plugins, ]); })() ;
{ "jsc": { "parser": { "syntax": "ecmascript", "jsx": false }, "target": "es2022", "externalHelpers": true, "transform": { "react": { "development": true, "runtime": "automatic" } }, "minify": { "compress": { "arguments": false, "arrows": true, "booleans": true, "booleans_as_integers": false, "collapse_vars": true, "comparisons": true, "computed_props": true, "conditionals": true, "dead_code": true, "directives": true, "drop_console": false, "drop_debugger": true, "evaluate": true, "expression": false, "hoist_funs": false, "hoist_props": true, "hoist_vars": false, "if_return": true, "join_vars": true, "keep_classnames": false, "keep_fargs": true, "keep_fnames": false, "keep_infinity": false, "loops": true, "negate_iife": true, "properties": true, "reduce_funcs": false, "reduce_vars": false, "side_effects": true, "switches": true, "typeofs": true, "unsafe": true, "unsafe_arrows": false, "unsafe_comps": false, "unsafe_Function": false, "unsafe_math": false, "unsafe_symbols": false, "unsafe_methods": false, "unsafe_proto": false, "unsafe_regexp": false, "unsafe_undefined": false, "unused": true, "const_to_let": true, "pristine_globals": true, "passes": 999 }, "mangle": false, "inlineSourcesContent": false }, "loose": false }, "minify": false, "isModule": true, "module": { "type": "es6" }, }
https://play.swc.rs/?version=1.10.1&code=H4sIAAAAAAAAA5WQT0vEMBDF7%2FspHivsJkXs3bLe9uwieBIp2XS2RmJa8kfE0u%2FutFHpIihewmTmzbzf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B%2F1zevncff2bawXI0uXiXzkzZs1fQQfesmX5d%2Fv%2FQpRfgGAAA%3D
No response
should be minimized
1.10.1
The text was updated successfully, but these errors were encountered:
Wow. It's an interesting edge case. I forgot that I implemented a rule to remove unused class declarations.
Sorry, something went wrong.
Ah. It's removed because the class declaration is inlined. https://play.swc.rs/?version=1.10.6&code=H4sIAAAAAAAAA5WQQUvEMBCF7%2FsrHivsJkXs3bLe9uwieBIp3XR2jcS0TBIRl%2F53J61KFxHxEpKZl%2B%2B9GaU0Njc4LYBlCoQQ2Zq4rORtXBMCto5eyEecMHzXdp318atBb5F8OxOKDMJpojWwLTZY91m%2FrsaG6bx4JBM7VuZw1J96%2BZF6YqUnVfYaFnK8Ngzz1HCsaeIHAd7un8nEqwMTvZPKgHmi67NXBgn0N1RZXNT17v5uW9dFqcoCycsaWvSJSUbrmUKwnUfHU0AUJXxyDqsV1M8cfybRU5ZxC2A62hCJm72jHOa%2F%2Fg%2FTRs9mupzVepeO1o%2Blx2w8aKXlXn0AFEZ1VfUBAAA%3D&config=H4sIAAAAAAAAA32Vy64aMQxA9%2F0KNOu7qO6iEt1Wqrrpqh8QhcQZQvNS7HBBV%2Fx7PQ%2FoAB52jI%2FfNs7nl82mO6Dpvm8%2B%2BSd%2FFF0R6u2bJXhOpE8s6cBEjab6Qt3blR5wQE4HhFF0mUhHuvZAoxW%2Bf31%2Fny06OBHUpMMvCAUqsgLVBlejqhO6XOMyfgVtaCFgkYUjhFwiJLpzMOm3RD7CEFo3ylGTN92ML3c5Rp%2B8Oy9jmRxLBcT7cFxKG2LhtdK3Jav5A5%2Bz2OUcgKtZJ0qj8omgn9rw6NjkEHRBUEddBS9Dprp6zFKIATYCq0rNReTJevKZ5yBQC9oqky0IyFcw5I8gmXEsNkvI5Qn1jNjCrvX9uF8P1nDUoWkSYsJpHAlnK3jdZ4%2BkXEtSCye40oMJzs19tPROVaBW07PdIfu0MpO%2FANyBoBGTjiD5HTUc79OatXtp6ZPjlaWzwEMWq0zQc1OV907o7NAZqOSlaVawzcDQWSOlM%2BOV9qG3oMA53hXBNX54MnspKJ0LZCcAnq%2BWKpjk6vYnfExk5sP%2F4QX%2ByUWSvF%2BzBh%2BR%2FTrFc9zl8CJABNpn%2B0KBJ0F5HVc%2BEqeyzluywJsBVlRpOILnG8D7T1kFEI5o4dNC7FH1Ie%2FEK1F4zccZbrfb63W9vQpRp%2F75CnQ%2BBfb5J7dqAH9kPn7jAX9%2BPXibERZklP%2B%2F1zevncff2bawXI0uXiXzkzZs1fQQfesmX5d%2Fv%2FQpRfgGAAA%3D
85fb16c
Thank you !
kdy1
Successfully merging a pull request may close this issue.
Describe the bug
webpack use some strategy to help minifier minimize more bundle size.
But swc failed to transform this, while it can be minimized without
null && foo
You can remove comment in line 11
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.10.1&code=H4sIAAAAAAAAA5WQT0vEMBDF7%2FspHivsJkXs3bLe9uwieBIp2XS2RmJa8kfE0u%2FutFHpIihewmTmzbzfjBASuxsMK2CdAiFEb3RcV%2FzXVoWAvaUXchEDxu%2FcoTMufhXoLZJrFkKWgeeoaDRMgx22%2FaTfVnNBd449ko6dF%2FrUyk89d6SevJBZNXmNK37KEq%2FKQz8pH2vKFoFnlsVFXR%2Fu7%2FZ1XZS4PT6TjlcnT%2FROYsh9S8rrs1%2Buj%2BzF0d%2FjRVkgOb5Ogz554o17TyGYzqHzmRsM4ZK12GwgftLgd5hRyswyHweeWhMieXW0NMH81%2F8hH%2Fpsp8tFrrepNW5OPU7GoxSS4%2BoDVgwMRAwCAAA%3D&config=H4sIAAAAAAAAA32Vy64aMQxA9%2F0KNOu7qO6iEt1Wqrrpqh8QhcQZQvNS7HBBV%2Fx7PQ%2FoAB52jI%2FfNs7nl82mO6Dpvm8%2B%2BSd%2FFF0R6u2bJXhOpE8s6cBEjab6Qt3blR5wQE4HhFF0mUhHuvZAoxW%2Bf31%2Fny06OBHUpMMvCAUqsgLVBlejqhO6XOMyfgVtaCFgkYUjhFwiJLpzMOm3RD7CEFo3ylGTN92ML3c5Rp%2B8Oy9jmRxLBcT7cFxKG2LhtdK3Jav5A5%2Bz2OUcgKtZJ0qj8omgn9rw6NjkEHRBUEddBS9Dprp6zFKIATYCq0rNReTJevKZ5yBQC9oqky0IyFcw5I8gmXEsNkvI5Qn1jNjCrvX9uF8P1nDUoWkSYsJpHAlnK3jdZ4%2BkXEtSCye40oMJzs19tPROVaBW07PdIfu0MpO%2FANyBoBGTjiD5HTUc79OatXtp6ZPjlaWzwEMWq0zQc1OV907o7NAZqOSlaVawzcDQWSOlM%2BOV9qG3oMA53hXBNX54MnspKJ0LZCcAnq%2BWKpjk6vYnfExk5sP%2F4QX%2ByUWSvF%2BzBh%2BR%2FTrFc9zl8CJABNpn%2B0KBJ0F5HVc%2BEqeyzluywJsBVlRpOILnG8D7T1kFEI5o4dNC7FH1Ie%2FEK1F4zccZbrfb63W9vQpRp%2F75CnQ%2BBfb5J7dqAH9kPn7jAX9%2BPXibERZklP%2B%2F1zevncff2bawXI0uXiXzkzZs1fQQfesmX5d%2Fv%2FQpRfgGAAA%3D
SWC Info output
No response
Expected behavior
should be minimized
Actual behavior
No response
Version
1.10.1
Additional context
No response
The text was updated successfully, but these errors were encountered: