Closed mostaphaamghare closed 1 year ago
The correct import is this:
import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.mjs";
It sounds like something about your project is incorrectly setup relating to the way Node.js ESM and CJS works together:
https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#interoperability-with-commonjs
It's certainly not an issue with graphql-upload
; I'm able to import and use the current version fine in projects.
You might find this comment helpful: https://github.com/jaydenseric/graphql-upload/issues/334#issuecomment-1236223984 .
Getting SyntaxError: Cannot use import statement outside a module only when trying to import graphql-upload module
`` import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.mjs";
and when I use this
import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.js";`` I get Error: Package subpath './graphqlUploadExpress.js' is not defined by "exports @jaydenseric