vatson / rollup-plugin-vuetify

Vuetify autoloader 🤖
MIT License
20 stars 1 forks source link

Unexpected token when parsing Typescript types #49

Closed raphaelcfernandes closed 3 years ago

raphaelcfernandes commented 3 years ago

Hello,

I'm trying to use the plugin along with my typescript Vue and Vuetify, however whenever I try to declare a typed variable plugin-vuetify complains about unexpected token. My TS script:

import Vue from 'vue'

export default Vue.extend({
  name: "Test",
  props: {
    title: {
      type: String,
      required: true
    }
  },
  mounted() {
    const t: string = "Hello World"
  }
})

The following error is the only thing I get and line 40:11 points exactly to

const t: string =  "Hello World

If I remove this line the pluging doesn't fail, and it also pass for title type: String

[!](plugin vuetify) SyntaxError: Unexpected token (40:11)
src/components/MyComponent/Test.vue?rollup-plugin-vue=script.ts (40:11)
SyntaxError: Unexpected token (40:11)
    at Object._raise (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.parseVar (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/statement.js:1019:18)
    at Object.parseVarStatement (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/statement.js:694:10)
    at Object.parseStatementContent (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/statement.js:211:21)
    at Object.parseStatement (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/statement.js:151:17)
    at Object.parseBlockOrModuleBlockBody (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/statement.js:871:25)
    at Object.parseBlockBody (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/statement.js:841:10)
    at Object.parseBlockBody (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/plugins/estree.js:195:13)
    at Object.parseBlock (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/statement.js:811:10)
    at Object.parseFunctionBody (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/expression.js:2130:24)
    at Object.parseFunctionBody (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/plugins/estree.js:277:13)
    at Object.parseFunctionBodyAndFinish (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/expression.js:2103:10)
    at Object.parseMethod (/home/raphael/Documents/testProject/node_modules/@babel/parser/src/parser/expression.js:2003:10)
vatson commented 3 years ago

Hey @raphaelcfernandes

I tried to reproduce this behavior but was unable to.

Could you provide more information like rollup config, tsconfig? The best option is a repository with code that doesn't work.

vatson commented 3 years ago

Hello @raphaelcfernandes,

I did not receive an answer for a long time which indicates that either the issue is no longer relevant or the problem has been resolved.

I close the issue. Let me know if you still have any questions so I can reopen the issue or create a new one.