More helpful error message for missing decoratorsBeforeExport in parser (#8576)

This commit is contained in:
Nicolò Ribaudo 2018-08-29 16:02:18 +02:00 committed by Brian Ng
parent 04d09cc754
commit 9d244ae66b
2 changed files with 5 additions and 3 deletions

View File

@ -55,8 +55,10 @@ export function validatePlugins(plugins: PluginList) {
); );
if (decoratorsBeforeExport == null) { if (decoratorsBeforeExport == null) {
throw new Error( throw new Error(
"The 'decorators' plugin requires a" + "The 'decorators' plugin requires a 'decoratorsBeforeExport' option," +
" 'decoratorsBeforeExport' option, whose value must be a boolean.", " whose value must be a boolean. If you are migrating from" +
" Babylon/Babel 6 or want to use the old decorators proposal, you" +
" should use the 'decorators-legacy' plugin instead of 'decorators'.",
); );
} else if (typeof decoratorsBeforeExport !== "boolean") { } else if (typeof decoratorsBeforeExport !== "boolean") {
throw new Error("'decoratorsBeforeExport' must be a boolean."); throw new Error("'decoratorsBeforeExport' must be a boolean.");

View File

@ -1,4 +1,4 @@
{ {
"plugins": ["decorators"], "plugins": ["decorators"],
"throws": "The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean." "throws": "The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'."
} }