graphql-community / graphql-community/graphql-directive-auth

require('graphql-directive-auth') does not work as intended

Open
#16 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
135
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Hello!

I have installed the dependency via `npm install graphql-directive-auth` and in order to use it I must first retrieve the `default` property from `require('graphql-directive-auth')` like so:

```js
const AuthDirective = require('graphql-directive-auth').default;
```

Which is not how it is specified in the documentation. This does not happen when using the `import` keyword:

```js
import AuthDirectives from 'graphql-directive-auth';
```

I believe this has something to do with TypeScripts module bundling.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the documented require() and import forms after installing graphql-directive-auth, then inspect the package's published TypeScript module output and bundling configuration. Done means the CommonJS usage matches the documentation, or the documentation accurately explains the required default export.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.