loganfsmyth / babel-plugin-transform-decorators-legacy

A plugin for Babel 6 that (mostly) replicates the old decorator behavior from Babel 5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect local name w/ native classes & babel-minify

developit opened this issue · comments

Looks like the local name gets mangled with babel-minify, but not references to it.

  • This only happens when classes are not transpiled (eg: no preset, or env preset with >4%) and minify is used.
  • Changing to an expression (const Foo = @hello class {}) works, though the name is not mangled
  • The effect is still present when no decorator is used.

It seems like the outer variable name assigned by the decorators plugin is being mangled when it shouldn't be (since without the decorator it is unmangled).

Input Output
@hello
class Foo {};
new Foo();
var _class;
let a = hello(_class = class Foo {}) || _class;
new Foo();

Babel REPL Link