Can't create type with .default
iam-mishgun opened this issue · comments
Mishgun commented
Version "mongoose-schema-to-graphql": "^2.7.2"
My type:
const createType = require('mongoose-schema-to-graphql').default;
const Calendar = require('../../models/calendar');
module.exports = createType({
name: 'Calendar',
description: 'Calendar collection type',
class: 'GraphQLObjectType',
schema: Calendar.schema,
exclude: ['_id']
});
Returns this error:
module.exports = createType({
^
TypeError: createType is not a function
If I use withiut .default
I'm having only created name (in this case name = Calendar). So this will create new error:
GraphQLError: Syntax Error: Unexpected Name "Calendar"
Where I can find normal example with this implementation? (example app)