Problem with @babel/preset-stage-2
Closed this issue · 2 comments
Just bought the template and tried to run "npm run install && npm run dev", and got a compilation error:
ERROR Failed to compile with 1 errors 7:10:05 PM
error in ./src/main.js
Module build failed: Error: [BABEL] /Users/anton/ui/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/anton/ui/node_modules/@vue/babel-preset-app/index.js$1")
at /Users/anton/ui/node_modules/@babel/preset-stage-2/lib/index.js:107:11
at /Users/anton/ui/node_modules/@babel/helper-plugin-utils/lib/index.js:18:12
at /Users/anton/ui/node_modules/@babel/core/lib/config/full.js:172:14
at cachedFunction (/Users/anton/ui/node_modules/@babel/core/lib/config/caching.js:42:17)
at loadPresetDescriptor (/Users/anton/ui/node_modules/@babel/core/lib/config/full.js:243:63)
at /Users/anton/ui/node_modules/@babel/core/lib/config/full.js:68:19
at Array.map (<anonymous>)
at recurseDescriptors (/Users/anton/ui/node_modules/@babel/core/lib/config/full.js:66:36)
at recurseDescriptors (/Users/anton/ui/node_modules/@babel/core/lib/config/full.js:97:26)
at loadFullConfig (/Users/anton/ui/node_modules/@babel/core/lib/config/full.js:112:6)
@ multi (webpack)-dev-server/client/index.js (webpack)/hot/dev-server.js ./src/main.js
I didn't do any changes in the downloaded template, just tried to compile it. It seems that when you built the plugin, the dependencies (vue/cli-plugin-babel and vue/babel-preset-app) relied on previous version of babel/preset-stage-2, and as it's still in beta, the most recent version breaks the API.
Could you please assist?
Thanks!
Hi @anton-belousov
Do you have a .babelrc
file?
A common issue is that people don't copy over .babelrc
file since it might be hidden on some operating systems.
babelrc should contain
{
"presets": [
"@vue/app"
],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
],
[
"module-resolver",
{
"alias": {
"src": "./src"
}
}
]
]
}
Hi @cristijora,
Yes, I do and it has exactly the same content.
I found that the problem was in broken vue-cli dependency, see here - vuejs/vue-cli#1162. That means the issue is not related to your template in particular, but to vue-cli, so I'm closing the issue. That bug was anyway closed 5 hours ago.
Sorry for disturbing you with that and thank you for your great work. That's what sometimes happens when using libraries in beta, I have to get used to it.