egoist / vue-compile

Compile the blocks in Vue single-file components to use JS/CSS instead of Babel/Sass/Stylus.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for the experimental syntax 'decorators-legacy' isn't currently enabled

johannes-z opened this issue Β· comments

Running vue-compile .\src\components\Component.vue -o ./dist/Component.vue fails with this error message when using vue-class-component:

SyntaxError: ...\src\components\Component.vue: Support for the experimental syntax 'decorators-legacy' isn't currently enabled (129:1):

  127 | import { debounce } from '../VirtualScroll/debounce'
  128 | 
> 129 | @Component({
      | ^

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

Do you have a custom babel config file? It's supposed to pick it up if it exists.

Yes, I used vue-cli 4 to create a project for eslint/webpack-dev-server, and added the typescript plugin.
The babel.config.js looks like this:

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ]
}

I've also created a repro: https://github.com/johannes-z/vue-compile-test

I ran this command vue-compile .\src\components\HelloWorld.vue -o dist/HelloWorld.vue, which fails with:

SyntaxError: ...\vue-compile-test\src\components\HelloWorld.vue: Unexpected token (39:18)

  37 | @Component
  38 | export default class HelloWorld extends Vue {
> 39 |   @Prop() private msg!: string;
     |                   ^
  40 | }

It's different than the other error I got, but I still think they are somehow connected.

Just realized that you're using TypeScript, this lib currently doesn't apply custom babel config while transpiling TypeScript, maybe we should πŸ€” PR welcome

Ref: https://github.com/egoist/vue-compile/blob/master/src/script-compilers/ts.ts

πŸŽ‰ This issue has been resolved in version 0.6.1 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€