vitejs / vite-plugin-vue2-jsx

Vite plugin for Vue 2.7 JSX support
MIT License
58 stars 6 forks source link

How to enable 'decorators' support? #14

Closed linusang-spark closed 1 year ago

linusang-spark commented 1 year ago

I'm facing this issue while building my project in vite. I'm using Vue 2.7. I have some components using the @Component syntax.

SyntaxError: unknown: Support for the experimental syntax 'decorators' isn't currently enabled
linusang-spark commented 1 year ago

ok got it to work by installing @babel/plugin-proposal-decorators and setting it in the options.

vueJsx({
      babelPlugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
    }),