SyntaxError: Unexpected token ‘export’
Oct 5, 2020
If you are using require like:
const schema = require(‘./schema.js’);
and you have exported in schema.js like:
export default new GraphQLSchema({query: RootQuery});
In case you are getting error like ‘Unexpected token export’ while starting the server, then export like below in schema.js
exports.schema = new GraphQLSchema({query: RootQuery});
or
module.exports = new GraphQLSchema({query: RootQuery});