babel: On update to version 7.00-beta.46 Get Decorators Support Error [BUG]

This is error I get, The new decorators proposal is not supported yet. You must pass the"decoratorsLegacy": true option to @babel/preset-stage-2 (While processing

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 13
  • Comments: 23 (10 by maintainers)

Commits related to this issue

Most upvoted comments

The new decorators proposal is not supported yet. You must pass the "decoratorsLegacy": true option to @babel/preset-stage-2

I think the error message is correct? I believe I made it pretty clear above, but it’s

{
  "presets": [
    "@babel/env",
    "@babel/preset-react",
+    ["@babel/preset-stage-2", { "decoratorsLegacy": true }]
-    "@babel/preset-stage-2"
  ]
}

Also like I mentioned if you use "@babel/core": "^7.0.0-beta.44", and we make an intentional breaking change it will break the build automatically. That’s why I’m suggesting people pin the version while in beta (we’ve tried to suggest this since it’s not released but difficult to get that message across especially when it’s the default)

Can you kindly update the docs, as to how to resolve this breaking change. As to what changes are required to make in .babelrc file.

Thank you so much for reaching out & helping with this, I’ll write an article about this with a publication like freeCodeCamp & try to spread the word out.

I see. Still, it doesn’t seem reasonable that the default behaviour of stage <= 2 presets is to crash the build.

So everyone’s on the same page here. Babel is still in beta, and we are still making breaking changes. If you are using a prerelease version of any package, you should be using a lockfile and only upgrading it when you’re ready to test out the new version, just like if it were a new major version release.

Personally I wouldn’t use ^ in the version at all, but if you want to, you must at least use a lockfile or else you are opting into instability.

Don’t want to speak for @nicolo-ribaudo but he probably meant @babel/plugin-proposal-decorators

["@babel/plugin-transform-decorators", { "legacy": true }]

I’ll write an article about this with a publication like freeCodeCamp & try to spread the word out.

I’m a bit confused, is this article about this bug, about Babel 7, or my comment about pinning the version in beta?

Was the error message not clear enough in your opinion? I know it assumes knowledge about presets/options.

I’m going to close this either way though, the message is correct! Thanks.

My .package.json file’s dev dependencies look something like this.

    "@babel/core": "^7.0.0-beta.44",
    "@babel/preset-env": "^7.0.0-beta.44",
    "@babel/preset-react": "^7.0.0-beta.44",
    "@babel/preset-stage-2": "^7.0.0-beta.44",
    "babel-loader": "^8.0.0-beta.2",
    "css-loader": "^0.28.11",
    "copy-webpack-plugin": "^4.5.0",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.2.0",
    "mini-css-extract-plugin": "^0.4.0",
    "node-sass": "^4.8.3",
    "sass-loader": "^6.0.7",
    "webpack": "^4.5.0",
    "webpack-cli": "^2.0.14",
    "webpack-dev-server": "^3.1.3"
  },```

and my `.babelrc` file looks like this

`
{
  "presets": [
    "@babel/env",
    "@babel/preset-react",
    "@babel/preset-stage-2"
  ]
}
`
This was working fine 2-3 days ago, but today when I shipped I got the error for 

`The new decorators proposal is not supported yet. You must pass the"decoratorsLegacy": trueoption to @babel/preset-stage-2 (While processing`