mongoose-schema-to-graphql icon indicating copy to clipboard operation
mongoose-schema-to-graphql copied to clipboard

It's not a commonJS module

Open ash0080 opened this issue 7 years ago • 4 comments

const createType = require('mongoose-schema-to-graphql')
// built index.js line 291
exports.default = createType;

not work

ash0080 avatar Jan 08 '18 16:01 ash0080

Hi, just try:

const createType = require('mongoose-schema-to-graphql').default;

or

import createType from 'mongoose-schema-to-graphql';

sarkistlt avatar Jan 08 '18 17:01 sarkistlt

.default not work, I have tried

ES6 import can not work without babel. For now, ES6 module still not an accepted standard for nodeJS, so I only use ES6 module in frontend with package tool, for backend I never use it or mix it with commonJS, it will cause a lot of problems

ash0080 avatar Jan 09 '18 04:01 ash0080

try new version from npm 2.7.1 it should be compatible with commonJS

sarkistlt avatar Jan 09 '18 17:01 sarkistlt

Works, Thanks a million

ash0080 avatar Jan 09 '18 18:01 ash0080