apollo
apollo copied to clipboard
New project config broken: require statement not part of import statement
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:
-
vue create someapp
- Select vue 2, typescript support, CSS preprocessor, everything else is default
-
vue add apollo
- 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
Same issue here.
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, }