Skip to content

[Bug]: class decorator context.kind is 'field', should 'class' #16179

@ghost

Description

💻

  • Would you like to work on a fix?

How are you using Babel?

@rollup/plugin-babel

Input code

@DecTest
class Test {}

function DecTest(value, ctx) {
  console.log(ctx.kind, ctx, value);
}

Configuration file name

No response

Configuration

import { babel } from "@rollup/plugin-babel";

export default defineConfig(() => {
  const babelPlugins = [
    ["@babel/plugin-proposal-decorators", { version: "2023-05" }],
  ];

  return {
    build: {
      target: "es6",
      outDir: "./dist",
      emptyOutDir: true,
    },

    plugins: [
      babel({
        extensions: [".js", ".ts"],
        babelrc: false,
        configFile: false,
        compact: false,
        babelHelpers: "bundled",
        plugins: babelPlugins,
      }),
    ],
  };
});

Current and expected behavior

context.kind should 'class'

image

image

Environment

macos
node 18
chrome
vite 5

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Spec: Decoratorsi: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions