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

Failed to transform decorators with babel-plugin-transform-decorators@6.0.14 #2801

Closed
soulwu opened this Issue Nov 4, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@soulwu

soulwu commented Nov 4, 2015

source code test.js as below:

function testable(target) {
  target.isTestable = true;
}

@testable
class MyTestableClass {}

and with .babelrc

{
    "presets": ["es2015", "stage-0"]
}

When run babel, failed

$ babel test.js
TypeError: test.js: Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got "Decorator"
    at Object.validate (/Users/soulwu/test/node_modules/babel-types/lib/definitions/index.js:99:13)
    at validate (/Users/soulwu/test/node_modules/babel-types/lib/index.js:295:9)
    at Object.builder (/Users/soulwu/test/node_modules/babel-types/lib/index.js:248:7)
    at maybeMemoise (/Users/soulwu/test/node_modules/babel-helper-explode-class/lib/index.js:29:32)
    at memoiseDecorators (/Users/soulwu/test/node_modules/babel-helper-explode-class/lib/index.js:56:7)
    at Object.exports.default (/Users/soulwu/test/node_modules/babel-helper-explode-class/lib/index.js:61:3)
    at PluginPass.ClassDeclaration (/Users/soulwu/test/node_modules/babel-plugin-transform-decorators/lib/index.js:164:45)
    at /usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/visitors.js:271:19
    at NodePath._call (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:72:18)
    at NodePath.call (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:44:17)

need help...

@kstevens715

This comment has been minimized.

Show comment
Hide comment
@kstevens715

kstevens715 Nov 4, 2015

I've been having the same problem tonight.

kstevens715 commented Nov 4, 2015

I've been having the same problem tonight.

@loganfsmyth

This comment has been minimized.

Show comment
Hide comment
@loganfsmyth

loganfsmyth Nov 4, 2015

Member

This looks like a duplicate of #2645

Member

loganfsmyth commented Nov 4, 2015

This looks like a duplicate of #2645

@loganfsmyth loganfsmyth closed this Nov 4, 2015

@TaopaiC TaopaiC referenced this issue Nov 8, 2015

Closed

Babel 6 #46

@lock lock bot added the outdated label Jul 10, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Jul 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.