apollo icon indicating copy to clipboard operation
apollo copied to clipboard

New project config broken: require statement not part of import statement

Open sburris0 opened this issue 3 years ago • 2 comments

Describe the bug

Done in 7.27s.
Successfully installed plugin: vue-cli-plugin-apollo

? Add example code No
? Add a GraphQL API Server? No
? Configure Apollo Engine? No

Invoking generator for vue-cli-plugin-apollo...
 Running completion hooks...error: Require statement not part of import statement (@typescript-eslint/no-var-requires) at apollo.config.js:1:14:
> 1 | const path = require('path')
    |              ^
  2 | 
  3 | // Load .env files
  4 | const { loadEnv } = require('vue-cli-plugin-apollo/utils/load-env')


error: Require statement not part of import statement (@typescript-eslint/no-var-requires) at apollo.config.js:4:21:
  2 | 
  3 | // Load .env files
> 4 | const { loadEnv } = require('vue-cli-plugin-apollo/utils/load-env')
    |                     ^
  5 | const env = loadEnv([
  6 |   path.resolve(__dirname, '.env'),
  7 |   path.resolve(__dirname, '.env.local')


2 errors found.

To Reproduce Steps to reproduce the behavior:

  1. vue create someapp
  2. Select vue 2, typescript support, CSS preprocessor, everything else is default
  3. vue add apollo
  4. Observe error messages shown above

Expected behavior I expect new projects to not have errors before I edit anything myself.

Versions vue: 2.6.12 vue-apollo: 3.0.5 apollo-client: 3.2.9

sburris0 avatar Nov 25 '20 17:11 sburris0

Same issue here.

c0bra avatar Dec 17 '20 15:12 c0bra

The reason for this problem may be that you use eslint . You can try to add rules in the .eslintrc.js file. rules: { '@typescript-eslint/no-var-requires': 0, }

Jason0715 avatar Mar 08 '21 02:03 Jason0715