From c331a94943ffc2e4f727d412df2f98f7f8eb6cee Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 2 Aug 2016 20:47:03 -0400 Subject: [PATCH] Show a more informative error message when using the decorator transform and link to the legacy one [skip ci] (#3626) --- .../src/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-decorators/src/index.js b/packages/babel-plugin-transform-decorators/src/index.js index ae3b5469cf..1b3fbed6f8 100644 --- a/packages/babel-plugin-transform-decorators/src/index.js +++ b/packages/babel-plugin-transform-decorators/src/index.js @@ -71,7 +71,20 @@ export default function ({ types: t }) { } function doError(path) { - throw path.buildCodeFrameError("Decorators are not supported yet in 6.x pending proposal update."); + throw path.buildCodeFrameError( +`Decorators are not officially supported yet in 6.x pending a proposal update. +However, if you need to use them you can install the legacy decorators transform with: + +npm install babel-plugin-transform-decorators-legacy --save-dev + +and add the following line to your .babelrc file: + +{ + "plugins": ["transform-decorators-legacy"] +} + +The repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy. + `); } return {