Skip to main content

@babel/plugin-syntax-decorators

note

Syntax only

It's unlikely you want to use this plugin directly as it only enables Babel to parse this syntax. Instead, use plugin-proposal-decorators to both parse and transform this syntax.

Installation

npm install --save-dev @babel/plugin-syntax-decorators

Usage

babel.config.json
{
"plugins": ["@babel/plugin-syntax-decorators"]
}

Via CLI

Shell
babel --plugins @babel/plugin-syntax-decorators script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-decorators"]
});

Options

This plugin accepts the same options as @babel/plugin-proposal-decorators.

tip

You can read more about configuring plugin options here