-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Conversation
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") ```
@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 }] ] } ```
hi @silkentrance , I'd made another change, so users can decide to use the option or not. |
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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 |
Just came across this in a brand new cli project |
Just a note... vue-cli itself is in beta too. |
So it's good to be finding issues!
We can't use `^` with Babel beta, they said it will continue to break and
they aren't using it internally with a hat. Semver doesn't work with betas.
…On Wed, Apr 25, 2018, 09:37 Evan You ***@***.***> wrote:
Just a note... vue-cli itself is in beta too.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1163 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAjhEgjymA14Xdeply5EUJsy2WKC_dBVks5tsHwVgaJpZM4TfZtm>
.
|
Will this PR alone fix the problem ? How would I pass the option needed to the file that was just modified ? |
@BenoitAverty I have a local {
"presets": [
[
"@vue/app",
{
"decoratorsLegacy": true
}
]
]
} This worked for me with the above patch. |
The above didn't work for me + "@babel/preset-stage-2": "7.0.0-beta.44"
|
I upgraded to beta 7, deleted and reinstalled node mods, and it worked |
Adding option
decoratorsLegacy: true
in@babel/preset-stage-2
for fixing this error :