Skip to content

Commit 64cbdd2

Browse files
committed
Add a note about Babel 7.x usage.
1 parent 5feb2c2 commit 64cbdd2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,35 @@ This is a plugin for Babel 6 that is meant to replicate the old decorator behavi
66
Babel 5 in order to allow people to more easily transition to Babel 6 without needing to
77
be blocked on updates to the decorator proposal or for Babel to re-implement it.
88

9+
## Babel >= 7.x
10+
11+
This plugin is specifically for Babel 6.x. If you're using Babel 7, this plugin is not for you.
12+
Babel 7's `@babel/plugin-proposal-decorators` officially supports the same logic that this
13+
plugin has, but integrates better with Babel 7's other plugins. You can enable this with
14+
15+
```json
16+
{
17+
"plugins": [
18+
["@babel/plugin-proposal-decorators", { "legacy": true }],
19+
]
20+
}
21+
```
22+
in your Babel configuration. Note that `legacy: true` is specifically needed if you
23+
want to get the same behavior as `transform-decorators-legacy` because there
24+
are newer versions of the decorator specification coming out, and they do not
25+
behave the same way as this plugin does.
26+
27+
928
## Installation & Usage
1029

1130
$ npm install --save-dev babel-plugin-transform-decorators-legacy
12-
31+
1332
Add the following line to your .babelrc file:
1433

1534
{
1635
"plugins": ["transform-decorators-legacy"]
1736
}
18-
37+
1938
#### NOTE: Order of Plugins Matters!
2039
If you are including your plugins manually and using `transform-class-properties`, make sure that `transform-decorators-legacy` comes *before* `transform-class-properties`.
2140

0 commit comments

Comments
 (0)