Rich-Harris / butternut

The fast, future-friendly minifier
https://butternut.now.sh
MIT License
1.17k stars 17 forks source link

Class Decl with a method in IIFE throws #29

Closed boopathi closed 7 years ago

boopathi commented 7 years ago
// works
class A {}

// also works
class A {
  foo() {}
}

// also works
(function() {
  class A {}
})()

// throws an error - this.scope is undefined
(function () {
  class A {
    foo() {}
  }
})();
/Users/brajaa/workspace/butternut/dist/butternut.cjs.js:3015
        this.scope.mangle( code );
                  ^

TypeError: Cannot read property 'mangle' of undefined
Rich-Harris commented 7 years ago

I stumbled upon this a moment ago as well — it's already fixed by https://github.com/Rich-Harris/butternut/pull/25 so I'll close this. Thanks