File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,35 @@ This is a plugin for Babel 6 that is meant to replicate the old decorator behavi
6
6
Babel 5 in order to allow people to more easily transition to Babel 6 without needing to
7
7
be blocked on updates to the decorator proposal or for Babel to re-implement it.
8
8
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
+
9
28
## Installation & Usage
10
29
11
30
$ npm install --save-dev babel-plugin-transform-decorators-legacy
12
-
31
+
13
32
Add the following line to your .babelrc file:
14
33
15
34
{
16
35
"plugins": ["transform-decorators-legacy"]
17
36
}
18
-
37
+
19
38
#### NOTE: Order of Plugins Matters!
20
39
If you are including your plugins manually and using ` transform-class-properties ` , make sure that ` transform-decorators-legacy ` comes * before* ` transform-class-properties ` .
21
40
You can’t perform that action at this time.
0 commit comments