Reports GraphQL syntax errors in cjs & mjs files
See original GitHub issueActual Behavior
when writing cjs or mjs, vscode-graphql reports gql syntax errors on the first keyword.
Expected Behavior
no error is shown and vscode-graphql treats it like other js files insteadof trying to parse it as gql
Steps to Reproduce the Problem Or Description
create an cjs or mjs file and add any valid js code, e.g. in a cjs file:
module.exports = {};
Specifications
- GraphQL for VSCode Extension Version: 0.3.15
- VS Code:
- Version: 1.53.2 (system setup)
- Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
- Date: 2021-02-11T11:48:04.245Z
- Electron: 11.2.1
- Chrome: 87.0.4280.141
- Node.js: 12.18.3
- V8: 8.7.220.31-electron.0
- OS: Windows_NT x64 10.0.19042
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Handling operation errors - Apollo GraphQL Docs
These are errors related to the server-side execution of a GraphQL operation. They include: ... If a syntax error or validation error occurs,...
Read more >Instead change the require of index.js, to a dynamic import ...
In my case, I was getting the error after installing the latest version of crypto-random-string package. To know which package is causing ...
Read more >import fetch from "node-fetch"; ^^^^^^ syntaxerror: cannot ... - You.com
This will ensure that all .js and .mjs files are interpreted as ES modules. ... Error "SyntaxError: Cannot use import statement outside a...
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
Use ESM - use import foo from 'foo' , instead of const foo = require('foo') and add the following line to your package.json...
Read more >Configuring Jest
Jest's configuration can be defined in the package.json file of ... file or through the --config <path/to/file.js|ts|cjs|mjs|json> option.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m still seeing this as well. It causes a phantom error in vscode
Problems
pane that can never be fixed.confirmed. ✔️ thanks a lot for fixing it @acao ! 👍