Example config for babel 7, in decorators legacy mode:
//.babelrc
{
"presets": ["@babel/preset-env"],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
]
}
Please note that plugin ordering is important, and plugin-proposal-decorators should be the first plugin in your plugin list
"devDependencies": {
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-decorators": "^7.1.0",
"@babel/preset-env": "^7.1.0"
}
Non-legacy mode decorators (stage 2) is work in progress, see #1732
Edit: updated config to show the non-beta configuration for babel 7
Example config for babel 7, in decorators legacy mode:
Please note that plugin ordering is important, and
plugin-proposal-decoratorsshould be the first plugin in your plugin listNon-legacy mode decorators (stage 2) is work in progress, see #1732
Edit: updated config to show the non-beta configuration for babel 7