Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

734
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda