underfin / vite-plugin-vue2

Vue2 plugin for Vite
621 stars 84 forks source link

Property key of ObjectMethod expected node to be of a type ["Identifier","StringLiteral","NumericLiteral"] but instead got "MemberExpression" #202

Open jayzun opened 2 years ago

jayzun commented 2 years ago

I get a problem when running "vite build".

What is the meaning of: Property key of ObjectMethod expected node to be of a type ["Identifier","StringLiteral","NumericLiteral"] but instead got "MemberExpression" ?

Here is the full error message:

error during build:
TypeError: /Users/admin/work/code/brick/esop2-support/VueTemplateBabelCompiler: Property key of ObjectMethod expected node to be of a type ["Identifier","StringLiteral","NumericLiteral"] but instead got "MemberExpression"
    at validate (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js:130:11)
    at Object.validator [as validate] (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/core.js:598:11)
    at validateField (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/types/lib/validators/validate.js:24:9)
    at validate (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/types/lib/validators/validate.js:17:3)
    at NodePath._replaceWith (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/replacement.js:170:5)
    at NodePath.replaceWith (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/replacement.js:152:8)
    at Identifier (/Users/admin/work/code/brick/esop2-support/node_modules/vue-template-babel-compiler/lib/index.js:63:12)
    at NodePath._call (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:103:16)
    at TraversalContext.visitSingle (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:77:19)
    at TraversalContext.visit (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:131:19)
    at Function.traverse.node (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:82:17)
    at NodePath.visit (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/admin/work/code/brick/esop2-support/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:103:16)
bjensen commented 2 years ago

I get the same error. Have you managed to fix it?

jayzun commented 2 years ago

I get the same error. Have you managed to fix it?

Maybe a bug of vue-template-babel-compiler

JuniorTour/vue-template-babel-compiler#42

If you have ES6 object method shorthand in your template, try changing them to normal function.