Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing "The new decorators proposal is not supported yet." #1163

Merged
merged 3 commits into from
Apr 25, 2018

Conversation

tamatamvan
Copy link
Contributor

Adding option decoratorsLegacy: true in @babel/preset-stage-2 for fixing this error :

Module build failed: Error: [BABEL] /path/to/project/src/main.js: The new decorators proposal is not supported yet. You must pass the `"decoratorsLegacy": true` option to @babel/preset-stage-2 (While processing: "/path/to/node_modules/@vue/babel-preset-app/index.js$1")

Adding option `decoratorsLegacy: true` in `@babel/preset-stage-2` for fixing this error :
```
Module build failed: Error: [BABEL] /path/to/project/src/main.js: The new decorators proposal is not supported yet. You must pass the `"decoratorsLegacy": true` option to @babel/preset-stage-2 (While processing: "/path/to/node_modules/@vue/babel-preset-app/index.js$1")
```
@silkentrance
Copy link

@tamatamvan please let the user pass in the decoratorsLegacy option so that he/she can decide whether to use that option. See the proposal by @soft903 #1162 (comment)

let the users pass options for decorators legacy in from `.babelrc` or `babel` field in package.json.
eg :
```
{
  "presets": [
    ["@vue/app", {
      "decoratorsLegacy": true 
    }]
  ]
}
```
@tamatamvan
Copy link
Contributor Author

tamatamvan commented Apr 23, 2018

hi @silkentrance , I'd made another change, so users can decide to use the option or not.
if there's another suggestions, please don't hesitate to tell me.

@@ -17,7 +17,8 @@ module.exports = (context, options = {}) => {
const envOptions = {
modules: options.modules || false,
targets: options.targets,
useBuiltIns: typeof options.useBuiltIns === 'undefined' ? 'usage' : options.useBuiltIns
useBuiltIns: typeof options.useBuiltIns === 'undefined' ? 'usage' : options.useBuiltIns,
decoratorsLegacy: options.decoratorsLegacy || false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed for preset-env?
It seems decoratorsLegacy only affects stage-0/1/2.

Copy link

@hzoo hzoo Apr 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's only for stage 0,1,2. It's one of the unfortunate issues related to having stage presets at all since you might not even use decorators. This is why after a lot of discussion may just want to remove them since it's just an array of plugins that will constantly changing babel/babel#7770.

It's fine to make it a top level option to pass to the other preset though.

removing `decoratorsLegacy` options from envOptions, since it only affects stage-0/1/2.
@factoidforrest
Copy link

We should also lock the version of babel so this doesn't happen again. I was just talking to the Babel maintainers and they said that nobody should be using babel beta with a ^ because they WILL be breaking it more. They don't use it internally with a ^

@quantuminformation
Copy link

Just came across this in a brand new cli project

@yyx990803
Copy link
Member

Just a note... vue-cli itself is in beta too.

@factoidforrest
Copy link

factoidforrest commented Apr 25, 2018 via email

@yyx990803 yyx990803 merged commit fb013da into vuejs:dev Apr 25, 2018
@BenoitAverty
Copy link

Will this PR alone fix the problem ? How would I pass the option needed to the file that was just modified ?

@rynnova
Copy link

rynnova commented Apr 25, 2018

@BenoitAverty I have a local .babelrc which looks like this:

{
  "presets": [
    [
      "@vue/app",
      {
        "decoratorsLegacy": true
      }
    ]
  ]
}

This worked for me with the above patch.

@quantuminformation
Copy link

The above didn't work for me + "@babel/preset-stage-2": "7.0.0-beta.44"

 ERROR  Failed to compile with 1 errors                                                                                            08:29:08

 error  in ./src/main.js

Module build failed: Error: [BABEL] /Users/nikos/WebstormProjects/quantumjs2/src/main.js: The new decorators proposal is not supported yet. You must pass the `"decoratorsLegacy": true` option to @babel/preset-stage-2 (While processing: "/Users/nikos/WebstormProjects/quantumjs2/node_modules/@vue/babel-preset-app/index.js$1")

@quantuminformation
Copy link

I upgraded to beta 7, deleted and reinstalled node mods, and it worked

@tamatamvan tamatamvan deleted the patch-1 branch April 27, 2018 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants