0

I'm probably making a rookie mistake somewhere, but why is the console telling me to provide a typeDefs? When I am providing one by using export default in javascript from the file below. I tried re-installing the package and such, but I get the same error still.

schema.js :

export default `
    type Query {
        hi: String
    }
`;

Then a screenshot of my app.js and the error: enter image description here

I also tried this way of defining and exporting, and still get "Must provide typeDefs", and this was in the tutorial, schema.js:

const typeDefs = `
    type Query {
        hi: String
    }
`;

export default typeDefs;
Royce
  • 189
  • 6
  • 18

1 Answers1

1

You're using a default export in your type definitions, but trying to import a named export in app.js. Instead, the import should look like this:

import typeDefs from './server/schemas/schema'
Daniel Rearden
  • 80,636
  • 11
  • 185
  • 183
  • Thank you. I didn't think it was part of es6 syntax that way, but I searched and found this that helped my understanding of your answer. https://stackoverflow.com/questions/36795819/when-should-i-use-curly-braces-for-es6-import/36796281 Thank you again. – Royce Mar 04 '18 at 08:52