Skip to content

Commit

Permalink
docs: update project readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh Chawla committed Dec 11, 2023
1 parent a43a69a commit 58010f0
Showing 1 changed file with 66 additions and 4 deletions.
70 changes: 66 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,75 @@
# graphql-tag-swc-plugin
> Info
> # WIP
> uses `swc_core` crate, use legacy branch for support with nextjs

SWC plugin alternative to `babel-plugin-graphql-tag`

## Installation

```
npm install -D graphql-tag-swc-plugin
```

## Usage

### SWC

Add following to swc config (below with default values):

```
jsc: {
experimental: {
plugins: [
["graphql-tag-swc-plugin",
{
importSources: ["@apollo/client", "graphql-tag"],
gqlTagIdentifiers: ["gql"]
},
],
],
},
},
```

### Next js

Add following to next config (below with default values):

```
experimental: {
swcPlugins: [
["graphql-tag-swc-plugin",
{
importSources: ["@apollo/client", "graphql-tag"],
gqlTagIdentifiers: ["gql"]
},
],
],
},
```

## Configuration

Following props are accepted by plugin currently, inline with babel alternative:

1. `importSources`:
> default: `["@apollo/client", "graphql-tag"]`
import paths from where gql tag is imported for which plugin should compile graphql

2. `gqlTagIdentifiers`:
> default: `["gql"]`
Identifier by which graphql-tag will be imported.
Example: Here `import { gql } from "@apollo/client`, `"gql"` is the identifier.

## Contribution

All contributions are welcome!
For any bug / feature request please create a Pull request with fixture for the same whenever possible.

## Authors

- @rishabh3112 - Rishabh Chawla

## License

MIT

0 comments on commit 58010f0

Please sign in to comment.