graphql-community / graphql-directive-auth

GraphQL directive for handling auth
MIT License
136 stars 12 forks source link

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

Open tcerda95 opened 5 years ago

tcerda95 commented 5 years ago

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:

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:

import AuthDirectives from 'graphql-directive-auth';

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

chanlito commented 5 years ago

@tcerdaITBA yeah, I think this lib should put "module": "commonjs" to tsconfig.json

FluorescentHallucinogen commented 5 years ago

Is this issue fixed in 4979f42defc32a6c0aea7486b908ec24f56a5147?