graphql / graphql/graphiql

[graphiql] cm6-graphql | Cannot use import statement outside a module | import { getTokenAtPosition, getTypeInfo, getAutocompleteSuggestions, getDiagnostics } from 'graphql-language-service';

Open
#3,579 1 comment 0 reactions 0 assignees View on GitHub
bug cm-6
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

I am using CM6 in my project and want to add graphQL.

I am trying to import

```

import { graphql } from 'cm6-graphql';

```

And have a lib error: "_Cannot use import statement outside a module_"

~/node_modules/cm6-graphql/dist/index.js:1
import { getTokenAtPosition, getTypeInfo, getAutocompleteSuggestions, getDiagnostics } from 'graphql-language-service';
^^^^^^

### Expected Behavior

At first I've tried it in prod project, then created PoC app. I am expecting this import to work.

### Steps To Reproduce

1. Just create PoC app: `pnpm create svelte@latest codemirror-graphql`
2. Create src/routes/+page
```

import { graphql } from 'cm6-graphql';

```
3. run dev ` pnpm run dev`
4. open http://localhost:5173/ in browser

### Environment

* `cm6-graphql` Version: 0.0.14
* `svelte` Version: 4.2.7
* Bundler: vite 5.0.3

System
* OS: MacOS Sonoma 14.4.1

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.