Answer the question
In order to leave comments, you need to log in
How to configure Webpack to work with async/await in .vue files?
.babelrc looks like this:
{
"presets": ["env"],
"plugins": [
"transform-object-rest-spread",
"transform-runtime"
]
}
{
test: /\.js|vue$/,
enforce: 'pre',
exclude: /node_modules/,
loader: 'eslint-loader',
options: { configFile: './.eslintrc' }
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.vue$/,
exclude: /node_modules/,
use: [
{
loader:'vue-loader',
options: {
loaders: {
js: 'babel-loader'
}
}
}
]
}
test: async function () {
await Promise.resolve();
}
Answer the question
In order to leave comments, you need to log in
Salvation of a drowning man, the work of the drowning man himself :) Resolved the issue.
The error was caused by ESlint. I added the EcmaScript 8 version to .eslintrc and the async/await construct worked:
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question