0

This is probably a pretty esoteric and specific issue to my workflow, so I don't know if anyone else has come across it in the past. I use an aws-cloud9 workspace to do development for my Vue application. I recently started using dynamic imports in my vue-router file to split up chunks and reduce initial file load size. In terms of the webpack compiler and running in the browser, it works great! However, cloud9's linter (which I believe is using eslint) is failing as soon as it gets to my first dynamic import with the error 'Parsing error: Unexpected token import'. I have a .eslintrc.js file in the directory of my project which looks like this:

// https://eslint.org/docs/user-guide/configuring

module.exports = {
  root: true,
  parser: "vue-eslint-parser",
  parserOptions: {
    parser: 'babel-eslint',
    ecmaVersion: 2018,
    'allowImportExportEverywhere': true
  },
  env: {
    browser: true
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    'plugin:vue/essential',
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    'standard'
  ],
  // required to lint *.vue files
  plugins: [
    'vue',
    'babel'
  ],
  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'space-before-function-paren': 0,
    'semi': [1, 'always'],
    'quotes': 0,
    'no-tabs': 0,
    'allowImportExportEverywhere': true,
    'no-mixed-spaces-and-tabs': 0
  }
};

Other issues have mentioned edits to the eslintrc file to fix the issue. Changing the eslintrc file in my project changes what errors show up at compile time, but the aws-cloud9 ide is still presenting the error in the gutter.

whiplashomega
  • 49
  • 1
  • 9
  • Possible duplicate of [Dynamic Imports for Code Splitting cause: ESLint Parsing Error 'import'](https://stackoverflow.com/questions/47815775/dynamic-imports-for-code-splitting-cause-eslint-parsing-error-import) – Nikolay Vetrov Feb 02 '19 at 06:33
  • Issue mentioned is not a duplicate. The solution documented there does not fix the issue. eslint itself does not appear to be the issue. Vue compiles the script fine without showing any compile time linting errors, it is the aws-cloud9 linter that is presenting the error. – whiplashomega Feb 04 '19 at 15:21

0 Answers0