小编Agu*_*sti的帖子

如何在 next.config.js 或 babelrc 中启用@experimentalDecorators

嗨,如果有人愿意帮助我,我想在我的 nextjs 应用程序上使用 @Decorators,但出现以下错误。

希望有人知道我做错了什么

错误信息:

Syntax error: Support for the experimental syntax 'decorators-legacy' isn't currently enabled:
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用 typeorm / type-graphql 在应用程序子文件夹中生成我的后端。

应用程序/预订/模型/booking.ts

Syntax error: Support for the experimental syntax 'decorators-legacy' isn't currently enabled:
Run Code Online (Sandbox Code Playgroud)

巴别尔

{
  "presets": [
    [
      "next/babel",
      {
        "plugin-proposal-decorators": {"legacy": true}
      }
    ]
  ],
}
Run Code Online (Sandbox Code Playgroud)

下一个.config.js

import {
  Field,
  ID,
  ObjectType,
} from 'type-graphql';
import {
  BaseEntity,
  ManyToOne,
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
  VersionColumn,
} from 'typeorm';
import { ArrayNotEmpty, ArrayMinSize, IsPositive, Min, IsNotEmpty, ValidateNested, MaxLength, Length, …
Run Code Online (Sandbox Code Playgroud)

babeljs next.js javascript-decorators

6
推荐指数
1
解决办法
1534
查看次数

标签 统计

babeljs ×1

javascript-decorators ×1

next.js ×1