Is there any follow up to this?
Thanks for the instructions - I’ve managed to get Vue working quite well. However, the one issue I’ve come across so far is that my Sage site doesn’t seem to want to change es6
.
This is my .eslintrc.js
file. It has ecmaVersion set to 2017
, which is the version in which async
await
were added.
module.exports = {
'root': true,
'extends': [
'eslint:recommended',
'plugin:vue/essential',
],
'globals': {
'wp': true,
},
'env': {
'node': true,
'es6': true,
'amd': true,
'browser': true,
'jquery': true,
},
'parserOptions': {
'ecmaFeatures': {
'globalReturn': true,
'generators': false,
'objectLiteralDuplicateProperties': false,
'experimentalObjectRestSpread': true,
},
'ecmaVersion': 2017,
'sourceType': 'module',
},
'plugins': [
'import',
],
'settings': {
'import/core-modules': [],
'import/ignore': [
'node_modules',
'\\.(coffee|scss|css|less|hbs|svg|json)$',
],
},
'rules': {
'no-console': 0,
'quotes': ['error', 'single'],
'comma-dangle': [
'error',
{
'arrays': 'always-multiline',
'objects': 'always-multiline',
'imports': 'always-multiline',
'exports': 'always-multiline',
'functions': 'ignore',
},
],
},
};
I’m still getting the following error within a Vue component that is using async
await
.
ERROR Failed to compile with 1 errors 9:12:30 PM
error in ./resources/assets/scripts/vue/RequestForQuote.vue?vue&type=script&lang=js&
Module build failed:
47 : methods: {
48 :
49 : /* eslint-disable no-unused-vars */
50 :
51 : async addProduct() {
^
Unexpected token (51:10)
@ ./resources/assets/scripts/vue/RequestForQuote.vue?vue&type=script&lang=js& 1:0-289 1:310-596
@ ./resources/assets/scripts/vue/RequestForQuote.vue
@ ./resources/assets/scripts/routes/common.js
@ ./resources/assets/scripts/main.js
@ multi ./resources/assets/build/util/../helpers/hmr-client.js ./scripts/main.js ./styles/main.scss
Everyone has mentioned the 'ecmaVersion': 2018
fix, however that doesn’t work for me. I get the same error, and the impression that it’s not really changing anything, and Sage isn’t actually changing its ecma version.
When I’ve looked into the environments being used by eslint, it only seems to list es6 as an environment - changing this to something like es8 results in an error.
Would greatly appreciate any help on the matter - at the very least being shown how to definitively change the ecmaVersion within Sage.
Thanks!