Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

736
Views
Error: No "exports" main defined in graphql-upload/package.json

Have installed graphql-upload, do

import { graphqlUploadExpress } from 'graphql-upload';

And getting this error: Error: No "exports" main defined in graphql-upload/package.json

Dependencies:

"graphql-upload": "^14.0.0",
"graphql": "15.8.0",
"graphql-request": "^4.2.0",
"graphql-tools": "^8.2.0",
"@nestjs/axios": "^0.0.7",
"@nestjs/common": "^8.4.1",
"@nestjs/config": "^1.1.5",
"@nestjs/core": "^8.4.1",
"@nestjs/graphql": "^9.1.2",
"@nestjs/platform-express": "^8.0.0",

The version of node: v16.10.0

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

I have personally put a ts-ignore for ignore errors.

// @ts-ignore
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js';
// @ts-ignore
import Upload from 'graphql-upload/Upload.js';

And imports like that. I hope it can help even if it's dirty!

about 4 years ago · Juan Pablo Isaza Report

0

graphql-upload library doesn't have any main index.js re-export for all of its functions. It has direct file exports for all the specific functionalities. It is specified in its package.json file under exports key like so:

"exports": {
    "./GraphQLUpload.js": "./GraphQLUpload.js",
    "./graphqlUploadExpress.js": "./graphqlUploadExpress.js",
    "./graphqlUploadKoa.js": "./graphqlUploadKoa.js",
    "./package.json": "./package.json",
    "./processRequest.js": "./processRequest.js",
    "./Upload.js": "./Upload.js"
  },

So instead of directly importing from package root you need to specify a sub-module path like this:

import graphqlUploadKoa from "graphql-upload/graphqlUploadKoa.js";

Reference: package.json of graphql-upload

about 4 years ago · Juan Pablo Isaza Report

0

So the problem was in the .default build settings. You can remove it, but when we removed it we saw the problem with other modules, so we resolved this issue via this:

import Upload = require('graphql-upload/Upload.js');

It looks very dirty, but it works.

You can check conversation about this module in issues on GitHub: https://github.com/jaydenseric/graphql-upload/issues/305#issuecomment-1136574019

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!