I'm trying to use the library graphql-upload into my application of nestJs with graphQL and when I import the library I get this error:
Module '"graphql-upload"' has no exported member 'GraphQLUpload'.
This is how I import the library:
import { GraphQLUpload } from 'graphql-upload';
Also I mantion the versions I'm using maybe the problem could be there:
"graphql-upload": "^16.0.2",
"@types/graphql-upload": "^16.0.0",
"graphql": "^16.6.0",
"@types/node": "18.11.18",
"@nestjs/graphql": "^11.0.0",
"@nestjs/core": "^9.0.0",
"typescript": "^4.7.4"
To find a solution, i've tried to change verions of graphql-upload, graphql etc, I also tried to import the library in other ways such as:
const {
GraphQLUpload,
Upload,
graphqlUploadExpress, // A Koa implementation is also exported.
} = require('graphql-upload');
The problems is comming from your imports they need to be like that:
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js';
import Upload from "graphql-upload/Upload";