When a class includes an iterator method using Symbol.iterator, it is no longer tree-shaken when unused.
(() => {
class Test {
*[Symbol.iterator]() {
// do nothing
}
}
})()
Example
If you change this to *foo (still a generator function), or a non-generator with a static identifier as a name, it is tree-shaken. I believe this should be safe to tree shake with Symbol.iterator as well. SWC's minifier does so.
When a class includes an iterator method using
Symbol.iterator, it is no longer tree-shaken when unused.Example
If you change this to
*foo(still a generator function), or a non-generator with a static identifier as a name, it is tree-shaken. I believe this should be safe to tree shake withSymbol.iteratoras well. SWC's minifier does so.