Skip to content
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

Support decorators #45

Open
Mihailoff opened this issue Feb 3, 2023 · 1 comment
Open

Support decorators #45

Mihailoff opened this issue Feb 3, 2023 · 1 comment
Labels
question Further information is requested

Comments

@Mihailoff
Copy link

Mihailoff commented Feb 3, 2023

Failed to compile with 1 error(s)
Module parse failed: Unexpected character '@'
vue-template-babel-compiler v2.0.0

https://babeljs.io/docs/en/babel-plugin-proposal-decorators
https://babeljs.io/blog/2022/09/05/7.19.0

@JuniorTour
Copy link
Owner

Thanks for your feedback.

Do you mean this lib should enable the new class docorator sytax for vue.js .vue file?

@annotation
class MyClass {}

If so, maybe you can try add the babel plugin by the option of this lib:
https://github.com/JuniorTour/vue-template-babel-compiler/blob/main/doc/Usage.md#1-babel-options-customization

For example:

// vue.config.js
module.exports = {
    chainWebpack: config => {
        config.module
            .rule('vue')
            .use('vue-loader')
            .tap(options => {
                options.compilerOptions.babelOptions = {
                    plugins: [
                      '@babel/plugin-proposal-decorators'
                    ]
                }
                options.compiler = require('vue-template-babel-compiler')
                return options
            })
    }
}

If you could provide more context about how you use this anotation syntax in .vue file, I would like to help you more.

@JuniorTour JuniorTour added the question Further information is requested label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants