-
-
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
npm run serve error: You must pass the "decoratorsLegacy": true
option to @babel/preset-stage-2
#1162
Comments
Same. On a fresh install, using
package.json
|
As babel added "decoratorsLegacy" to presets few days ago I changed vue/babel-preset-app/index.js (line number: 17) |
missed another part need to change
|
@soft90 I solved the problem.Thank you very much! |
My working file of
added line 21: |
While those PR changes are discussed Maybe there should a hard lock onto the previous beta version of babel rather than a Edit: Confirmed, just talked to the babel maintainers who say that you should absolutely version lock your babel betas.
|
Really sorry this happened! We aren't in RC yet and there has been a few things we wanted to change before doing so. Unfortunately, this means that a project that is using Not really sure a better way to be able to talk/enforce this on our side. I think we've said this per release, but it hasn't broken in such an obvious way for people before? Here's Babel's own deps for Babel https://github.com/babel/babel/blob/3a2aa9b86284957533d01105754044fb6b235d41/package.json#L13-L15. |
fix? i am waiting |
I had solved the problem by using a custom config by {
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": [
"> 5%",
"last 2 versions",
"not ie <= 8"
]
},
"modules": false,
"exclude": [
"transform-regenerator"
]
}],
["@babel/preset-stage-2", {
"useBuiltIns": true,
"decoratorsLegacy": true
}]
],
"plugins": [
]
} |
Guys while this issue is not fixed, simply use this temporary solution:
then run |
Waiting! |
Waiting for what ? It's a beta of vue-cli, and multiple way to fix the issue has been given, just use them ? |
No one works for me @Pymous . |
@Hugale12 : Did you try #1162 (comment) ? You need to run |
"devDependencies": {
"@babel/preset-stage-2": "7.0.0-beta.44",
"@vue/cli-plugin-babel": "^3.0.0-beta.6",
"@vue/cli-plugin-eslint": "^3.0.0-beta.6",
"@vue/cli-plugin-pwa": "^3.0.0-beta.6",
"@vue/cli-plugin-unit-jest": "^3.0.0-beta.6",
"@vue/cli-service": "latest",
"@vue/eslint-config-airbnb": "^3.0.0-beta.6",
"@vue/test-utils": "^1.0.0-beta.14",
"autoprefixer": "^8.3.0",
"babel-core": "^7.0.0-0",
"babel-eslint": "^8.2.3",
"babel-jest": "^22.0.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"eslint": "^4.19.1",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"lint-staged": "^6.0.0",
"postcss-import": "^11.1.0",
"postcss-preset-env": "^3.2.2",
"vue-svgicon": "^2.1.3",
"vue-template-compiler": "^2.5.13"
I have that for the moment maybe change another thing ? |
I don't have any error with your dependancies on a clean folder. Try clearing your |
adding to Waiting for #1163 to be merged. |
One of my colleague have this error ... Mine is resolve
|
#1162 (comment) worked for me. Just to clarify, you'll want to add this the |
I solved this problem. |
Installing
const vueBabelPreset = require('@vue/babel-preset-app');
module.exports = (context, options = {}) => {
// Cache the returned value forever and don't call this function again.
context.cache(true);
const {presets, plugins} = vueBabelPreset(context, options);
// Find @babel/preset-stage-2, and update its config to enable `decoratorsLegacy`.
const presetStage2 = require('@babel/preset-stage-2');
const preset = presets.find(p => p[0] === presetStage2);
if (preset) {
preset[1].decoratorsLegacy = true;
}
return {
presets,
plugins
};
} This solution works better in my opinion because it maintains the settings originally intended by |
I think I tried most if not all of the suggestions thus far. Only thing that worked for me was this comment. Thanks @nitta-honoka |
i just found out that removing the babel entry in package.json also solves the issue. |
didn't work for me |
there is a new cli version published (beta7) that fixes this issue. This issue can be closed now. |
I'm using beta7 and still had the issue, until I deleted and reinstalled node mods |
Version
3.0.0-beta.6
Reproduction link
https://codepen.io/
Steps to reproduce
vue-cli will install @babel/preset-stage-2@7.0.0-beta.45 and npm run serve will throw error:
The new decorators proposal is not supported yet. You must pass the
"decoratorsLegacy": trueoption to @babel/preset-stage-2
see: https://github.com/babel/babel/blob/master/packages/babel-preset-stage-2/src/index.js#L29
forgive my poor English
What is expected?
server success
What is actually happening?
The new decorators proposal is not supported yet. You must pass the
"decoratorsLegacy": true
option to @babel/preset-stage-2The text was updated successfully, but these errors were encountered: