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

[Question] Don't support decorator ? #444

Closed
agileago opened this issue Jun 6, 2021 · 4 comments
Closed

[Question] Don't support decorator ? #444

agileago opened this issue Jun 6, 2021 · 4 comments
Labels
Accept question Further information is requested

Comments

@agileago
Copy link

agileago commented Jun 6, 2021

🧐 Problem Description

💻 Sample code

9:45:05 AM [vite] Internal server error: unknown: Support for the experimental syntax 'decorators-legacy' isn't currently enabled (6:3):

  4 |
  5 | class Model {
> 6 |   @IsPositive({ message: '必须为正整数' })
    |   ^
  7 |   @IsInt({ message: '必须为整数 ' })
  8 |   count: number = 0
  9 | }
  Plugin: vue-jsx
  File: /Users/jianhuaren/vite-antd/src/app.tsx
  4  |  
  5  |  class Model {
  6  |    @IsPositive({ message: '必须为正整数' })
     |    ^
  7  |    @IsInt({ message: '必须为整数 ' })
  8  |    count: number = 0
      at Object._raise (/Users/jianhuaren/vite-antd/node_modules/@babel/parser/lib/index.js:810:17)
      at Object.raiseWithData (/Users/jianhuaren/vite-antd/node_modules/@babel/parser/lib/index.js:803:17)
      at Object.expectOnePlugin (/Users/jianhuaren/vite-antd/node_modules/@babel/parser/lib/index.js:9995:18)

🚑 Other information

@agileago agileago added the question Further information is requested label Jun 6, 2021
@lizhancheng
Copy link

meet the same question, is there any solution?

@FranklyCai
Copy link

FranklyCai commented Dec 8, 2022

这说的不就是没开启legacy选项吗?给@babel/plugin-proposal-decorators插件传legacy为true的选项就可以了,比如vueJsx({ babelPlugins: [['@babel/plugin-proposal-decorators', { legacy: true }]] })

@a1444942531
Copy link

这说的不就是没开启legacy选项吗?给@babel/plugin-proposal-decorators插件传legacy为true的选项就可以了,比如vueJsx({ babelPlugins: [['@babel/plugin-proposal-decorators', { legacy: true }]] })

我滴个龟龟 原来是这样写的啊

@Kenhuey
Copy link

Kenhuey commented Nov 1, 2023

这说的不就是没开启legacy选项吗?给@babel/plugin-proposal-decorators插件传legacy为true的选项就可以了,比如vueJsx({ babelPlugins: [['@babel/plugin-proposal-decorators', { legacy: true }]] })

Works, well done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accept question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants